Tip 1 : Solve RS Aggarwal Aptitude and Problem Solving Books.
Tip 2 : Practice Coding questions from prepInsta.
Tip 3 : Worked on communication skills
Tip 1 : Mark skills with Bold letters.
Tip 2 : Mention projects on resume
- Morning time
- Environment was good.
- Interviewer was good



The attendees holding numbers from 1, 4, 3 are shown:

For the above example 1 -> 4 -> 3, 1 -> 3 -> 4 is the only correct answer, i.e nodes should be grouped sequentially. Hence, 3 -> 1 -> 4 is the wrong answer as we have to preserve the same order.
Step 1 : Iterate over the loop.
Step 2 : Separate out number divisible by 2 as even.



Input: 'arr' = [1, 2, 7, -4, 3, 2, -10, 9, 1]
Output: 11
Explanation: The subarray yielding the maximum sum is [1, 2, 7, -4, 3, 2].
Step 1 : First line of input contains size of array, which is denoted by N and second line of input contains N space separated integers.
Step 2 : First and only line of output should print the maximum subarray sum, N+1.
Step 3 : Apply merge sort
- Morning time
- Environment was good.
- Interviewer was good



s1 : This was solved by me through dynamic programming. Let dp[i][j] denote the maximum possible weight you can fill in the bag with a total capacity of j using exactly one stone of each color from 1 to i.
s2 : Now you can club all same-colored stones in a vector. Then this problem is same as the classical knapsack problem and I passed all test cases and selected for the next round.



The given Linked Lists are merging at node c1.
In this case, c1 is 'MERGING POINT'.

Step 1 : At first I gave the interviewer a complete brute force by considering each element of the first list and comparing it with each element of another list but that was inefficient.
Step 2 : So I gave the interviewer optimal approach by finding difference of lengths of linked list and then traverse bigger linked list to difference. Now start traversing both linked lists till we find the common element. This solution impressed the interviewer.



[1, 2, 3, 4] is a strictly increasing array, while [2, 1, 4, 3] is not.
Step 1 : Firstly I gave recursion approach but then the interviewer asked me to optimize.
Step 2 : So I gave him a standard DP approach for the longest increasing subsequences by storing the result and use them for future calculations of bigger problem.
- Morning time
- The environment was good.
- Interviewer was good



s1 : By follow approach Binary Search Tree, Check lef and right node leaf
s2 : Compare both nodes by checking which node is smallest
s2 : Merge both nodes



1. A node will be in the bottom-view if it is the bottom-most node at its horizontal distance from the root.
2. The horizontal distance of the root from itself is 0. The horizontal distance of the right child of the root node is 1 and the horizontal distance of the left child of the root node is -1.
3. The horizontal distance of node 'n' from root = horizontal distance of its parent from root + 1, if node 'n' is the right child of its parent.
4. The horizontal distance of node 'n' from root = horizontal distance of its parent from the root - 1, if node 'n' is the left child of its parent.
5. If more than one node is at the same horizontal distance and is the bottom-most node for that horizontal distance, including the one which is more towards the right.
Input: Consider the given Binary Tree:

Output: 4 2 6 3 7
Explanation:
Below is the bottom view of the binary tree.

1 is the root node, so its horizontal distance = 0.
Since 2 lies to the left of 0, its horizontal distance = 0-1= -1
3 lies to the right of 0, its horizontal distance = 0+1 = 1
Similarly, horizontal distance of 4 = Horizontal distance of 2 - 1= -1-1=-2
Horizontal distance of 5 = Horizontal distance of 2 + 1= -1+1 = 0
Horizontal distance of 6 = 1-1 =0
Horizontal distance of 7 = 1+1 = 2
The bottom-most node at a horizontal distance of -2 is 4.
The bottom-most node at a horizontal distance of -1 is 2.
The bottom-most node at a horizontal distance of 0 is 5 and 6. However, 6 is more towards the right, so 6 is included.
The bottom-most node at a horizontal distance of 1 is 3.
The bottom-most node at a horizontal distance of 2 is 7.
Hence, the bottom view would be 4 2 6 3 7
Step 1 : Bottom view of the binary tree will be printed on a separate line with all the nodes included in the bottom view separated by a single space.
Step 2 : Interviewer asked me to optimise the solution.
Step 3 : Then I gave solution with merge sort and interviewer was happy.

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