Given a DOM and an element in the node, find the kth ancestor of the element in the DOM.
Given arrival and departures of people in a hotel, tell the minimum number of rooms that need to be readied to accommodate all people. Input arrival: [17, 1, 1, 5, 10, 16], departure: [ 20, 20, 10, 6, 17, 20 ].
2nd round
Given a string, words are generated by appending the same word at each position in the substring. So for eg. ab will generate abab(append at 0th position), aabb(append at 1st position), abab(append at 2nd position) and so on. Now given an initial value('ab') and another string ('aababbab'), find that if the string can be generated from initial using previous method.
Given a string str, you need to write a query method which takes an Interval [i, j]
as input and return number whether substring in str[i:j] is palindrome or not. Assume that there'll be million of queries and you need to optimize the solution. For eg.
If str = xyzzy and i, j = 1, 4 then substring is yzzy which is a palindrome so return true.
If str = xyzzy and i, j = 0, 2 then substring is xyz which is not a palindrome so return false.
There's will be N queries like this, So input will be
xyzzy
1, 4
1, 3
0, 2
3rd round
LP questions.
Design an app like Quickride.
4th round
Design Payment flow of booking store website.
5th round
Design a system to show the top 10 frequent words from live tweets in last 5 seconds, 5 minutes and 5 hours.