Tip 1: Clarify constraints before coding.
Tip 2: Prioritize trade-off analysis.
Tip 3: Practice DP, graphs, and trees thoroughly, as these are their favourite topics.
Tip 1: Do not include false information on your resume.
Tip 2: Have at least one project that you understand end-to-end.
It was a 45-minute interview round where they asked a single question with some variations. It was conducted around 10 AM in the morning.



You can’t sell without buying first.
For the given array [ 2, 100, 150, 120],
The maximum profit can be achieved by buying the stock at minute 0 when its price is Rs. 2 and selling it at minute 2 when its price is Rs. 150.
So, the output will be 148.
Case 1: Product Data is Sorted by Timestamp
Approach: Binary Search. Since the data is ordered, I used std::upper_bound (in C++) to find the first element greater than the query timestamp, then moved one step back to get the “latest known price.”
Case 2: Both Product Data and Queries are Sorted
Approach: Two Pointers / Sliding Window. I maintained a pointer for the product array and iterated through the queries. Since both are sorted, the pointer only moves forward, making the lookup extremely efficient.
Case 3: Data is Unsorted
Approach: Pre-processing. I first sorted the product array by timestamp (O(N log N)) and then applied the Binary Search or Two-Pointer method, depending on whether the query vector was also sorted.
This was conducted on the same day after Round 1. It lasted around 60 minutes, during which they asked two DSA questions and a few behavioral questions.



Rotation of envelope is not allowed, that is, height and width can’t be exchanged
Sorting Strategy: I first sorted the envelopes by width in ascending order. For envelopes with the same width, I sorted them by height in descending order. This ensures that when we consider heights, we don’t pick two envelopes with the same width (since one cannot fit into another of equal width).
LIS Optimization: After sorting, the problem reduces to finding the Longest Increasing Subsequence (LIS) of the heights.
Complexity: I used an O(N log N) approach with binary search (std::lower_bound) to find the LIS, instead of the O(N²) DP approach, which was necessary given the constraints.



0 <= ‘ARR’[k] <= k
‘ARR’[k] = ‘ARR’[m] mod k, for all pairs of k,m such that k divides m.
Given ‘N’ = 3,
'A' = {0, -1, -1}
Then the answer is 6 because following sequences are possible:[0, 0, 0], [0, 1, 0], [0, 1, 1], [0, 1, 2], [0, 0, 1], [0, 0, 2].
Graph Construction: I treated this as a Topological Sort problem. Each element in the vectors is a node. For a vector like [1, 2, 3, 4], I added directed edges: 1 -> 2, 2 -> 3, and 3 -> 4.
Kahn’s Algorithm: 1. Calculated the in-degree of every unique number.
2. Added all nodes with in-degree 0 to a std::priority_queue (to maintain a consistent or sorted output if requested, like the 1 2 3 4 5 7 9 example).
3. Repeatedly popped the smallest element, added it to the result, and reduced the in-degree of its neighbours.
Complexity: O(V+E), where V is the number of unique elements and E is the total number of adjacent pairs in the input vectors.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
Which data structure is used to implement a DFS?