Tip 1 : Try to solve some good questions from every topic.
Tip 2 : If not have much time, then you can solve top interview questions from Leetcode.
Tip 3 : Made 2-3 good projects using any technology
Tip 1 : Keep resume short and crispy.
Tip 2 : Add coding profile handles and github link.
- Morning time
- Environment was good.
- No
- Interviewer was good



Let’s say we have n=4 nodes, 'LEFT_CHILD' = {1, -1, 3, -1} and
RIGHT_CHILD = {2, -1, -1, -1}. So the resulting tree will look like this:
It will return True as there is only one valid binary tree and each node has only one parent and there is only one root.
s1- I used level order traversal concept to solve this problem
s2- Apply sorting on the alphabetical order
- Morning time
- Environment was good.
- No
- Interviewer was good



A binary tree is considered balanced if the difference between the left subtree’s height and the right subtree’s height is less than or equal to 1, for all non-leaf nodes.
Consider N=2, there are three different binary trees.

s1- I used postorder tee traversal to solve this problem.
s2- first go on left subtree and return the height, similarly gets height of right subtree and check if absolute difference is less than or equal to 1.



If the given sequence ‘ARR’ has ‘N’ elements then the sorted wave array looks like -
‘ARR[0] >= ARR[1]’ and ‘ARR[1] <= ARR[2]’
‘ARR[2] >= ARR[3]’ and ‘ARR[3] <= ARR[4]’
‘ARR[4] >= ARR[5]’ and ‘ARR[5] <= ARR[6]’ And so on.
1. ‘ARR[0]’ must be greater than or equal to ‘ARR[1]’.
2. There can be multiple arrays that look like a wave array but you have to return only one.
3. We have an internal function that will check your solution and return 'True' in case your array is one of the solutions otherwise return 'False'.
The given array ‘ ARR = { 4, 3, 5, 2, 3, 1, 2 } ’
The below figure is a visual representation of the given ‘ARR’ and you can see we can express ‘ARR’ in a waveform array because
4>3 and 3<5
5>2 and 2<3
3>1 and 1<2
And it follows the condition of wave array.

Try to solve this problem in linear time complexity.
Step 1 : I explained her naive approach by sorting the linked list in O(n.log(n)) TC.,
Step 2 : interviewer asked me to optimise it.
Step 3 : After thinking sometime I told her the solution in O(n) TC, this time she seems to be happy and asked me to write the code



• The left subtree of a node contains only nodes with data less than the node’s data.
• The right subtree of a node contains only nodes with data greater than the node’s data.
• Both the left and right subtrees must also be binary search trees.
1. All the elements of the Binary Search Tree are unique.
2. You can’t use the same node value/element of BST twice.
tree: 8 5 10 2 6 -1 -1 -1 -1 -1 7 -1 -1
'K' = 13,

The nodes with values 8 and 5 as shown in the above figure gives sum equal to the given target 13.
Therefore, the output will be “true” i.e it is possible to find a pair in the given BST having sum equal to ‘K’.
Step 1 : Earlier, this question seems to be very easy, I told the approach using O(n) TC and O(n) SC, then interviewer asked me to optimise the SC.
Step 2 : I told the another approach using O(n(logn)) TC and O(1) SC, but again interviewer was not happy and this time she asked me to optimise TC.
Step 3 : After lot of thinking, I cam up with the solution using Stack DS, that takes O(n) TC and O(heigh_of_tree) SC, this was the approach interviewer was looking for, he asked me to write the code



1. A binary tree is a tree in which each node has at most two children.
2. The given tree will be non-empty.
3. The given tree can have multiple nodes with the same value.
4. If there are no nodes in the tree which are at distance = K from the given node, return an empty list.
5. You can return the list of values of valid nodes in any order. For example if the valid nodes have values 1,2,3, then you can return {1,2,3} or {3,1,2} etc.

Consider this tree above. The target node is 5 and K = 3. The nodes at distance 1 from node 5 are {2}, nodes at distance 2 from node 5 are {1, 4} and nodes at distance 3 from node 5 are {6, 3}.
Step 1 : Firstly, I gave BFS solution, first find the parent of every node of tree and then push pair of target_node, distance(k) in the queue, run the loop till queue is not empty and each time pop the top pair from queue and check if pair.second(distance) is 0 then add pair.first(node) in answer vector otherwise push pair.first right, left and parent(if exists), dis-1 in the queue.
Step 2 : Interviewer asked me to optimise the SC.
Step 3 : I told the approach using DFS in constant space, this time interviewer asked me to write the code.
- Morning time
- Environment was good.
- No
- Interviewer was good
How do you feel about working weekends and night shifts?
- Where do you see yourself 3 years from now? or Where do you see yourself in 5 years?
- Give an example of a time you had to respond to an unhappy manager/ customer/ colleague/ professor/ friend.
- How quickly do you adapt to new technology?-
- What software packages are you familiar with?
- On a scale of 1 to 10 how would you rate yourself as a leader?
Tip 1: Practice mock interview
Tip 2: Practice by college

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you remove whitespace from the start of a string?