Tip 1 : Always stay consistent in Coding
Tip 2 : Take help from others or make a group and keep daily targets set
Tip 3 : 500 Questions on leetcode will be great
Tip 1 : Do not put false information on Resume
Tip 2 : Whatever you write on resume , should be prepared thoroughly
Evening time
Coding Round



The last house is similar to a leaf node in a binary tree and a house that is present at ‘K’ distance from the last house should be the direct ancestor of this last house.

In this example :
2 is the direct ancestor of 4 and 5.
1 is the direct ancestor of 2, 3, 4, and 5.



Duplicate number is always present in the given array/list.



Morning time
Interviewer was nice and friendly




Modifies the original list ... to contain new list..
currNode -----next--->its copyNode ---->next Curr Node--->Next Copy Node
first create teh whole list... by adding new nodes as next nodes
then, assign random pointers by iterating
//then separate the lists
How does google auto correct works according to me
Tip 1 : Trie Data Structure
Tip 2 : Relevant keywords according to the trend
Tip 3 : Replace all key with incorrect and check if new word exists in the dictionary and relevant to it or not
Flow Diagram of Book My Show
Evening Timing


The width of each bar is the same and is equal to 1.
Input: ‘n’ = 6, ‘arr’ = [3, 0, 0, 2, 0, 4].
Output: 10
Explanation: Refer to the image for better comprehension:

You don't need to print anything. It has already been taken care of. Just implement the given function.
Using Two pointer approach - O(1) space and O(N) time
Using Stack - O(N) space and O(N) time
Four prisoners are given the opportunity of release and freedom if just one of them can work out the answer to a simple logic riddle. However, if they take part and one of them gives a wrong answer, or none of them can work out the answer at all, then their sentences will be doubled.
They are told that there are four hats. Two white and two black. Each man will have a hat placed on his head while blindfolded. When each man is wearing a hat the blindfolds will be removed. The prisoners will not be able to see their own hats and the only way they can work out what colour hat they are wearing will be from looking at the hats the other prisoners are wearing. All they have to do to win their freedom is for one of them to work out what colour hat he is wearing.
But there's a twist. To make it more interesting three prisoners stand in a line facing a brick wall. The prisoner at the back, A, stands on a box and can see both of the prisoners in front of him, B and C. Prisoner B stands on a smaller box and can only see prisoner C, who in turn can only see the wall. The fourth prisoner, D, stands on the other side of the wall and can see nothing of the other prisoners nor his own hat. They are not allowed to turn around, or converse in any way.
The prisoners are told that they have five minutes and to call out as soon as one of them thinks he knows for certain what colour hat he is wearing. But remember, if just one of them gets the answer wrong they will all have their sentences doubled.
Within the time allowed one prisoner calls out the right answer. Can you guess which one, what colour hat he is wearing and how he knew for sure?
After waiting about four minutes prisoner B calls out the right answer. He can see that C is wearing a white hat. If B was wearing a white hat too then A would have seen two white hats and would have known that his hat was black. As A didn't say anything B knew that he and C must have a different colour hats on and as C's hat is white, B knew that his hat must be black.



Down: (row+1,col)
Right: (row, col+1)
Down right diagonal: (row+1, col+1)
Minimum distance between source and destination using BFS algorithm.



‘num’ does not have leading zeros except when ‘num’ equals zero.
Input: ‘num’ = ‘141’ , ‘k’ = 1.
Output: ‘11’
Explanation: By removing only 1 digit from ‘num’, 3 numbers can be formed: 14, 11, and 41. Out of which 11 is the smallest number.
You don’t have to print anything. It has already been taken care of. Just implement the given function.

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