Tip 1 : Practice DSA daily.
Tip 2 : Make sure that all concepts of core subjects are clear.
Tip 3 : Be proficient in any one programming language.
Tip 1 : Resume should be 1 page long.
Tip 2 : Give more focus on Work experience and projects.
This was an online coding round. 4 questions on DSA were to be solved in 90 minutes.



DFS can be used to solve this problem. The idea is to place queens in different columns one by one, starting from the leftmost column. As we cannot place 2 queens in the same column, when we place the queen in the nth column and if its valid position, dfs again starting n+1 th column and try placing the next queen in all the rows of n+1th column and find a valid position. If no valid queen row found in n+1th row, backtrack and go to nth column, and change the queen position to the next row and repeat the process.



DP can be used to solve this problem efficiently.



The steps are:
Traverse the two linked lists in order to add preceding zeros in case a list is having lesser digits than the other one.
Start from the head node of both lists and call a recursive function for the next nodes.
Continue it till the end of the lists.
Creates a node for current digits sum and returns the carry.
This was the first online round after the coding round. The interview started off with each other's introductions. Then 2 DSA problems were asked and disussed.



1. The helper function ‘knows’ is already implemented for you.
2. ‘knows(A, B)’ returns "false", if A doesn't know B.
3. You should not implement helper function ‘knows’, or speculate about its implementation.
4. You should minimize the number of calls to function ‘knows(A, B)’.
5. There are at least 2 people at the party.
6. At most one celebrity will exist.
I used two pointer approach to solve this problem.
If for any pair ('i', ‘j’) such that 'i' != ‘j’, If ‘knows(i, j)’ returns true, then it implies that the person having id ‘i’ cannot be a celebrity as it knows the person having id ‘j’. Similarly if ‘knows(i, j)’ returns false, then it implies that the person having id ‘j’ cannot be a celebrity as it is not known by a person having id ‘i’.
So, the Two Pointer approach can be used where two pointers can be assigned, one at the start and the other at the end of the elements to be checked, and the search space can be reduced.



Input: Let the binary tree be:

Output: [10, 4, 2, 1, 3, 6]
Explanation: Consider the vertical lines in the figure. The top view contains the topmost node from each vertical line.
The approach is to use the preorder traversal of the tree to traverse the tree and check that we have visited the current vertical level and if visited then we can check for the smaller horizontal level node and store it. Else we can just update the vertical level as visited and store the node and horizontal level of the current node.
1) We have to create the map to check whether the horizontal level is visited or not as it will state the horizontal distance of the node from the root node. Where key will represent the horizontal distance and the value is the pair containing the value and level of each node.
2) We will traverse the tree using the preorder traversal.
3) Every time we check if the level of the current horizontal distance is less than the max level seen till now then we will update the value and the level for this horizontal distance.
4) We will pass level-1 for the left child and level+1 for the right child to get the vertical level.
5) Print the values present in the map.

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