Add office photos
Employer?
Claim Account for FREE

Salesforce

4.0
based on 928 Reviews
Video summary
Filter interviews by

Trent Interview Questions and Answers

Updated 29 Mar 2025
Popular Designations

Q1. Buy and Sell Stock Problem Statement

Imagine you are Harshad Mehta's friend, and you have been given the stock prices of a particular company for the next 'N' days. You can perform up to two buy-and-sell transa...read more

Ans.

The task is to determine the maximum profit that can be achieved by performing up to two buy-and-sell transactions on a given set of stock prices.

  • Iterate through the array of stock prices to find the maximum profit that can be achieved by buying and selling stocks at different points.

  • Keep track of the maximum profit that can be achieved by considering all possible combinations of buy and sell transactions.

  • Ensure that you sell the stock before buying again to adhere to the con...read more

Add your answer

Q2. Optimal Strategy for a Coin Game

You are playing a coin game with your friend Ninjax. There are N coins placed in a straight line.

Here are the rules of the game:

1. Each coin has a value associated with it.
2....read more
Ans.

The problem involves finding the optimal strategy to accumulate the maximum amount in a coin game with specific rules.

  • Start by considering the base cases where there are only 1 or 2 coins.

  • Use dynamic programming to keep track of the maximum amount that can be won at each step.

  • Consider the different scenarios when choosing a coin from either end of the line.

  • Keep track of the total winnings for both players and choose the optimal strategy to maximize your winnings.

  • Implement a r...read more

Add your answer

Q3. Longest Happy String Problem Statement

Given three non-negative integers X, Y, and Z, determine the longest happy string. A happy string is defined as a string that contains only the letters 'a', 'b', and 'c' w...read more

Ans.

The longest happy string problem involves constructing a string with 'a', 'b', and 'c' without having any three consecutive letters being the same.

  • Determine the maximum number of times 'a', 'b', and 'c' can appear in the string based on the given input values.

  • Construct the longest happy string by alternating between 'a', 'b', and 'c' while respecting the constraints.

  • Return '1' if a correct happy string can be formed, otherwise return '0'.

Add your answer

Q4. Spiral Matrix Problem Statement

You are given a N x M matrix of integers. Your task is to return the spiral path of the matrix elements.

Input

The first line contains an integer 'T' which denotes the number of ...read more
Ans.

The task is to return the spiral path of elements in a given matrix.

  • Iterate through the matrix in a spiral path by keeping track of boundaries.

  • Print elements in the order of top row, right column, bottom row, and left column.

  • Continue the spiral path until all elements are printed.

Add your answer
Discover Trent interview dos and don'ts from real experiences

Q5. Cycle Detection in a Singly Linked List

Determine if a given singly linked list of integers forms a cycle or not.

A cycle in a linked list occurs when a node's next points back to a previous node in the list. T...read more

Ans.

Detect if a singly linked list forms a cycle by checking if a node's next pointer points back to a previous node.

  • Traverse the linked list using two pointers, one moving one step at a time and the other moving two steps at a time.

  • If the two pointers meet at any point, there is a cycle in the linked list.

  • Use Floyd's Cycle Detection Algorithm for efficient detection of cycles in linked lists.

Add your answer

Q6. Minimum Swaps to Sort Array Problem Statement

Given an array arr of size N, determine the minimum number of swaps required to sort the array in ascending order. The array consists of distinct elements only.

Exa...read more

Ans.

The minimum number of swaps required to sort an array of distinct elements in ascending order.

  • Use a hashmap to store the index of each element in the array.

  • Iterate through the array and swap elements to their correct positions.

  • Count the number of swaps needed to sort the array.

Add your answer

Q7. Find median using min heap data structure in a stream of numbers

Ans.

Use two heaps to efficiently find the median in a stream of numbers.

  • Maintain two heaps: a max heap for the lower half and a min heap for the upper half.

  • When a new number arrives, compare it with the max of the lower half (max heap).

  • If it's smaller, add it to the max heap; otherwise, add it to the min heap.

  • Rebalance the heaps if their sizes differ by more than one.

  • The median is the root of the max heap if it has more elements, or the average of both roots if they are equal.

Add your answer

Q8. Deep diving into current project works

Ans.

I am currently working on developing a new feature for our company's website to improve user experience.

  • Researching user feedback and analyzing data to identify areas for improvement

  • Collaborating with designers and developers to create wireframes and prototypes

  • Implementing and testing the new feature to ensure functionality and usability

  • Gathering feedback from users through surveys and usability testing

  • Iterating on the feature based on feedback and data analysis

Add your answer

More about working at Salesforce

#12 Best Mid-Sized Company - 2022
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at Trent

based on 6 interviews
2 Interview rounds
Coding Test Round
Technical Round
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Member Technical Staff Interview Questions from Similar Companies

3.7
 • 32 Interview Questions
3.9
 • 20 Interview Questions
4.3
 • 16 Interview Questions
3.5
 • 10 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter