Hike Interview Experience | Set 5
1.Implement expiry cache system : every page in cache have id and expiry time (TTL of few seconds). After page expires it behaves as free space and can be used for new pages/replacement. Had a long discussion on everything.
very boring round
1. Nodes at given distance in binary tree
2.Check Mirror in N-ary tree
3. Largest Sum Contiguous Subarray
very boring round
1.Level order traversal Line by Line
2. ZigZag traversal of tree
3. Search in a Rotated Array
4.Value equal to index value
finally something new..
5. given a sorted array say A : (-4,-2,0,1,4,6,8,10). There is a function f(x) = a*x^2 + b*x + c , apply this function on A where x is any ith element from array A and a,b,c belongs to set of real numbers. Will f(A) will be sorted, if not then sort it in O(n).
It is very easy if you still remember concepts of quadratic equation from maths. I did not remember so he helped me.
Logic is that any quadratic equation is represented by parabola on graph and graph has minimum value at dy/dx = 0,i.e, 2*a*x + b = 0. Both sides of this point graph keeps increasing/decreasing to the infinity depending upon value of a. Calculate value of x = -b/(2*a). find it in sorted array or find its ceiling in log n. starting from this point to both ends, perform merge sort.
1. implement LRU cache
2. Implement following.
There are three type of request :
ii) www.someurl.com/stat/ -: return all id waiting to timeout along with their remaining timeout interval
ii) www.someurl.com/kill/conn_id=? -: end wait timeout of this conn_id and return response for this conn_id
I gave a solution with heap. He asked how to handle case when a request is waiting for timout and new request came in meantime. How to do server side scalability in this case.
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
Related Practice Problems
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon. Google and Microsoft Test Serieses.