Tip 1 : Try to code the data structures that you have learned to understand things better
Tip 2 : Try to solve the problem even if it is the worst possible solution you think and then try to optimize don't jump to get the
best possible solution
Tip 3 : Discuss things among peers it helps to improve the understanding, even try to teach someone anything new you learn, this is very helpful during the interviews as you will have habit of explaining things
Tip 1 : Try to be honest in the resume don't write something you don't know, most of the time it backfires.
Tip 2 : Try to make 2 good projects for cv and know about the challenges you can face on the project and think about how you can solve that challenge.
Timing: Morning
How was the environment? It happened in the Computer Lab of my institution
All students were assigned a computer and we had to solve questions on hackerrank
1. Consider that all elements in array ‘Height’ are unique.
2. It is guaranteed that a valid order always exists for the given array ‘Height’ and ‘Infront’.
Let there are 6 people, their heights are given by array ‘Height’ : [5, 3, 2, 6, 1, 4], and the number of people in front of them is given by array ‘Infront’: [0, 1, 2, 0, 3, 2]
Thus the actual order of people’s height in the queue will be [5, 3, 2, 1, 6, 4]
In this order, the first person in a queue i.e a person with a height of 5, has no person in front of them who is taller than him.
The second person in a queue i.e a person with a height of 3 has 1 person (person with height 5) in front of them who is taller than him.
The third person in a queue i.e a person with a height of 2 has 2 people (people with height 5 and 3) in front of them who are taller than him.
The fourth person in a queue i.e a person with a height of 1 has 3 people (people with height 5, 3, 2) in front of them who are taller than him.
The fifth person in a queue i.e a person with a height of 6 has no person in front of them who is taller than him.
The sixth person in a queue i.e a person with a height of 4 has 2 people (people with height 5, and 6) in front of them who are taller than him.
We can observe this is the only possible order that is possible according to the array ‘Infront’.
Round was a mix of concepts from OOPS, OS and Problem Solving
You may assume that duplicates do not exist in the tree.
For the given tree shown below:
For the binary tree shown in the figure, if ‘X’ = 6, the output will be 1 as node value 6 is present in the BST.
Easy approach, solved with log(n) complexity
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
Which array operation has O(n) worst-case time complexity?