Tip 1 :Do practice a lot of data structures questions as mostly questions in interviews are based on them.
Tip 2 : do prepare for projects mentioned in your resume and skills which you have mentioned.
Tip 3 :Be confident
Tip 1 : Resume should be one page.
Tip 2 : Do not be repetitive
Tip 3 : Be confident about techs you mention on your resume
This was a DSA round purely where 2 coding questions were asked.One was to find the next greater element in array and second was min platforms required for trains with arrival and departure time given in array.



Input: 'a' = [7, 12, 1, 20]
Output: NGE = [12, 20, 20, -1]
Explanation: For the given array,
- The next greater element for 7 is 12.
- The next greater element for 12 is 20.
- The next greater element for 1 is 20.
- There is no greater element for 20 on the right side. So we consider NGE as -1.
Using Stack
The time complexity can be easily reduced to linear by using extra space. The idea is to use the stack data structure.
For each element x in the array, pop all elements from the stack smaller than x, and set their next greater element to x.
Loop till we have a greater element on top of the stack or stack becomes empty. Then push the current element x on top of the stack.
Repeat the process for every array element.
class Main
{
// Find the next greater element for every array element
public static int[] findNextGreaterElements(int[] input)
{
// base case
if (input == null) {
return input;
}
int[] result = new int[input.length];
Arrays.fill(result, -1);
// create an empty stack
Stack s = new Stack<>();
// do for each element
for (int i = 0; i < input.length; i++)
{
// loop till we have a greater element on top or stack becomes empty.
// Keep popping elements from the stack smaller than the current
// element, and set their next greater element to the current element
while (!s.isEmpty() && input[s.peek()] < input[i]) {
result[s.pop()] = input[i];
}
// push current "index" into the stack
s.push(i);
}
return result;
}



1. Every train will depart on the same day and the departure time will always be greater than the arrival time. For example, A train with arrival time 2240 and departure time 1930 is not possible.
2. Time will be given in 24H format and colons will be omitted for convenience. For example, 9:05AM will be given as "905", or 9:10PM will be given as "2110".
3. Also, there will be no leading zeroes in the given times. For example, 12:10AM will be given as “10” and not as “0010”.
The idea is to merge the arrival and departure times of trains and consider them in sorted order. Maintain a counter to count the total number of trains present at the station at any point. The counter also represents the total number of platforms needed at that time.
If the train is scheduled to arrive next, increase the counter by one and update the minimum platforms needed if the count is more than the minimum platforms needed so far.
If the train is scheduled to depart next, decrease the counter by 1.
One special case needs to be handled – when two trains are scheduled to arrive and depart simultaneously, depart the train first.
class Main
{
// Function to find the minimum number of platforms needed
// to avoid delay in any train arrival
public static int findMinPlatforms(double[] arrival, double[] departure)
{
// sort arrival time of trains
Arrays.sort(arrival);
// sort departure time of trains
Arrays.sort(departure);
// maintains the count of trains
int count = 0;
// stores minimum platforms needed
int platforms = 0;
// take two indices for arrival and departure time
int i = 0, j = 0;
// run till all trains have arrived
while (i < arrival.length)
{
// if a train is scheduled to arrive next
if (arrival[i] < departure[j])
{
// increase the count of trains and update minimum
// platforms if required
platforms = Integer.max(platforms, ++count);
// move the pointer to the next arrival
i++;
}
// if the train is scheduled to depart next i.e.
// `departure[j] < arrival[i]`, decrease trains' count
// and move pointer `j` to the next departure.
// If two trains are arriving and departing simultaneously,
// i.e., `arrival[i] == departure[j]`, depart the train first
else {
count--;
j++;
}
}
return platforms;
}
The time complexity of the above solution is O(n.log(n)) and doesn’t require any extra space, where n is the total number of trains.
In this round,focus was on puzzle solving mainly.2 puzzles were asked. one was,there is a game with some fee while enter and exit and i have to make 0 amount in end and some constraints were given.second was of 3 ants and triangle standard puzzle.
There are 3 ants sitting on three corners of a triangle. All ants randomly pick a direction and start moving along edge of the triangle. What is the probability that any two ants collide?
Every ant has two choices (pick either of two edges going through the corner on which ant is initially sitting).
Since every ant has two choices (pick either of two edges going through the corner on which ant is initially sitting), there are total 23 possibilities.
Out of 23 possibilities, only 2 don’t cause collision. So, the probability of collision is 6/8 and the probability of non-collision is 2/8.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is recursion?