Oyo Rooms Interview Experience | Set 9
Round 1 : This was online coding round consisting of 2 coding questions each of 100 marks and 15 objective questions each of 2 marks.If you have basic knowledge of C, Java, Operating System, DBMS you can score easily.
Coding question 1 – Given an array A. Three integers a, b and d. You can add or subtract a or b any number of times to d. You need to check how many elements can be formed by applying these operations to d and those elements should be in range 0 to 10^9.
Solution: So consider the equation ax + by = c. For an integer solution to (x, y) c should be divisible by gcd(a, b)
So answer= multiples of gcd in given range for ex if a=2 and b=4 and d=5. gcd(2, 4)=2 so elements that can be formed are 1(5-4), 3(5-2) 5, 7, 9, 11, 13, 15 ….
Coding question 2 – Given a matrix. Empty cells are represented by ‘.’, cells which are occupied are represented by ‘B’. Given two cells ‘S’ and ‘D’, find the minimum distance required from S to D.
initialize dis[m][n] as infinite.
This is a simple BFS question. This question is not a dp question as we can move in all 4 directions .You can use bfs and each time update corresponding distance in tht cell i, j if i, j is a valid move and dis[i][j]>curr dist then dis[i][j] =curr and curr++;
For objective questions go through geeksforgeeks CS Subjects Section.
Only 2 students were able to solve both coding questions. I was one of those :p .But still 6 students were shortlisted for interview round.
Round 2: This round lasted about 50 minutes. The interviewer asked me some basic DS questions( 2-3 ques from interview bit ) after asking about my projects and internship.
1.Given a set of time intervals in any order, merge all overlapping intervals into one and output the result which should have only mutually exclusive intervals
Refer – https://www.geeksforgeeks.org/merging-intervals/
2. Implement LRU Cache. He asked me to implement it in my project.
3. Find the distance between two keys in a binary tree, no parent pointers are given.
Refer – https://www.geeksforgeeks.org/find-distance-between-two-nodes-of-a-binary-tree/
4 Given a binary tree, print boundary nodes of the binary tree Anti-Clockwise starting from the root
5 Given three stack of the positive numbers, the task is to find the possible equal maximum sum of the stacks with removal of top elements allowed.
last que (easiest one ) sutta kaha milta hai tumhare campus mein :p
I answered all ques 🙂 and last one with full confidence :p
- Basic paging segment and OS scheduling questions
- Code for Dining philosopher problem
- print all views of a binary tree ?
I soved in 2 traversal . Then he asked me to solve in 1 . Finally i did
Refer- for left view https://www.geeksforgeeks.org/print-left-view-binary-tree/
Refer for right view – https://www.geeksforgeeks.org/print-right-view-binary-tree-2/
but u have to print all views (bottom top right left ) all in traversal.Use bfs traversal and for each level the leftmost one will be left view at that level and rightmost one will be the right one
and for top and bottom use https://www.geeksforgeeks.org/print-nodes-top-view-binary-tree/ (hosrizontal dis technique) for each dis the first node will be top view and the last node for tht dis will be bottom view
use hashing to do store all view separately in 1 traversal
- Given a number x, find sum of digits in all numbers from 1 to n.
2 students were selected after 2 rounds. Other had round 3 also .
Final Tip : when its your day to get selected . no one can stop u . Go for it just go through geeksforgeeks that would be enough.