Round 1
An array of the heights of objects and an array of the heights of the contiguous storage areas were given. For an object to be placed in a certain storage column it should pass through all the previous columns. Give an arragement of the objects such that maximum number of objects could fit.
Ex- Obj heights: 3,4,1,3,5
Storage heights: 3,4,2,3,5
Ans: 3,3,-1,-1,1
(-1 indicating no object could be placed)
Round 2
Given an array and a value k, find the number of non overlapping subarray pairs such that all the elements in the subarray have value >=k
Ex - 3,4,1,5,6 and k=3
Ans: 11
Round 3
Consider a mountain as an isosceles right angled triangle with hypotenuse on the x-axis. Given coordinates (x,y) of the peaks of mountains, find the number of visible mountains.
The question was pretty vague and eventually it boiled down to finding the extent of each mountain i.e. interval covered by each mountain and finding the number of non overlapping intervals.
Round 4
Round 5
Find the number of "always searchable" elements given an unsorted array and choosing a random pivot at each step instead of the usual way as it happens in binary search.
Ex- 3,2,1,4
Ans: 1, because 4 can be searched always. 4 is on the correct side of every number in the array whatever be the pivot
The first 3 rounds were back to back without any break unless you finish a round early :) There was a 1 hr lunch break with a Google employee. The remaining 2 rounds were back to back after lunch. Some rounds went well while some went really bad for me, but I guess overall it was an amazing experience to interview for Google.
Last but not the least, a big thank you to the leetcode community. I've learnt a lot by practicing on leetcode. I hope to continue practising even more and doing better next time!