Tip 1: Code More.
Tip 2: Study Data Structures.
Tip 3: Be Confident.
Tip 1: Mention only what you are confident about.
Tip 2: Mention tools & technologies used in the project as well.
25 MCQs and 2 coding questions & Webcam was on.



The given string st = AABCBDC.

As you can see there are two repeating longest subsequences “ABC” with the same character but different position. Therefore the required answer is ‘3’ as the length of “ABC” is 3.
I first thought of the brute force approach. Then, I tried to solve for LIS, which I had already solved once. Finally, I implemented the DP approach for LDS.



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.
Stack implementation
The next day at 8 AM, the interviewer was very friendly and provided various hints. The interview covered complex coding questions on tree data structures.



‘POINTS = [ [3, 1], [-1, 3], [2, 0] ]’, ‘N = 3’

The path with minimum time is: ‘[3,1] -> [2,2] -> [1,3] - > [0,3] -> [-1,3] -> [0,2] -> [1,1] -> [2,0]’.
Time taken from [3,1] to [-1,3] = 4 seconds.
Time taken from [-1,3] to [2,0] = 3 seconds.
Total time = 7 seconds. Thus, you should return ‘7’ as the answer.
I first thought of DFS, and BFS approaches but then tried using heap but couldn't solve since the approach was wrong.



Since, I messed up in the first question and already wasted a lot of time. I couldn't come with any approach.

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