Tip 1 : Code as many questions as you can,
Tip 2 : Take care of small things like freeing memory in case we want to delete node from linked list.
Tip 1 : Have some programming project on resume.
Tip 2 : Not that important for this interview.
The question was that there are n bombs having some sizes. In the subsequent time - top two stones collide with each other, the smaller stone is destroyed completely and bigger stone's size is reduced by size of smaller stone. What will be the size of last stone.



Input: Let the binary tree be:

Output: 2
Explanation: The root node is 3, and the leaf nodes are 1 and 2.
There are two nodes visited when traversing from 3 to 1.
There are two nodes visited when traversing from 3 to 2.
Therefore the height of the binary tree is 2.
Used the above approach for a general tree.
The interviewer was very friendly. He even asked me to address him by his first name to get me comfortable. He first talked about my life before JEE and about the stuff I did in college apart from academics. Then he came straight to the questions. He asked me the same questions from online test and then this question:
Find the square root of a number.
Told him the binary search solution and he was satisfied.
Asked one OS question too which I was not able to answer.



N = 4
Edges = [2 3], [4 3], [1 3]
Output: 2
Here node 4 is at a distance 2 from node 1 and if we make node 1 as a root, it will give the height of 2, which is the maximum possible in this tree.
I told him that DFS is better if the tree is wide but height is less.
BFS is better if tree has a less width.
The difference is only in space complexities in the 2 approaches.



Input: ‘n’ = 7
Output: 2
Explanation:
The square root of the number 7 lies between 2 and 3, so the floor value is 2.
This interview was not in a room, we were standing in the corridor and he started it there only.
Asked me about how the previous interview went.
Why should I hire you?
If I give you a project on pascal , would you agree to take it?
What is your goal in life?
What are your strengths and weaknesses?

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