# Oyo Rooms Interview Experience (On-Campus for SDE)

**Round 1 (Online Coding Round): This round consisted of 20 MCQs from Data Structures, Algorithms, Output-based C programs, OS, DBMS (SQL queries) and a few aptitude questions. There were 2 coding questions as follows:**

- The first question was simple “Largest Sum Subsequence in an array without taking adjacent elements”. https://www.geeksforgeeks.org/find-maximum-possible-stolen-value-houses/
- The second was bit of a visualization based problem. ‘n’ points are given which are diagonally opposite to the point (1, 1) making rectangles with sides parallel to the axes. Also, there are ‘r’ buildings whose coordinates (xi, yi) along with their heights (hi). We have to find out the maximum height among all buildings that are inside a rectangle.Total 32 students got shortlisted out of 150 for the next round of interviews conducted the next day. Those could get one question fully and got partial marks in the second one were selected. This round was organized in HackerEarth (2hrs)

**Round 2 (Technical Round 1 F2F): The interview started out with the basic walk-through of my resume and the interviewer asked me to explain all that I had done while at college. Then he started out with a question that went like this**

- Given a rectangle sheet of dimensions (L x R). We are also given an array of pairs of numbers (Xi, Yi) that are the dimensions of the cut that we can perform on the sheet. The question was “How do we optimally go on cutting the rectangular sheet so that at the end, we are left with minimum area uncut?” The same cut-dimension from the array can be chosen any number of times. I thought about the tile-problem in DP and went about thinking about it. Explained him my recursive approach, he didn’t seem satisfied. I couldn’t get the solution fully. There were minimal hints from him. Then he went on to the second question.
- Given an array of integers and a value of k=3. Find the maximum in every subarray of size k. I started out with the brute force approach and started to prune it down using sliding window method. Then I further optimized it using deque. He asked to write code for the method. With a little help on the edge-cases, I wrote the working code.This round went on for about 1 hour and 20 minutes.

18 students out of 33 were selected for the next round.

**Round 3 (Technical Round 2 F2F): The interviewer started out with the usual “Tell me about yourself” and then took a dig on my projects and technologies I had worked on. Later, he went on with some algorithmic questions:**

- Given an array of integers, find the maximum among all the absolute differences between indices of the two elements to the left and right of the current element that are smaller than it and are the nearest to it.

eg: Array : {2, 3, 5, 1, 3}

For element at index 1 (3), 2 is lesser than it on the right, its index i=0. Then 1 is lesser than it on the right and is the nearest with index, j=3. So for element 3, diff = abs(i-j) = |0-3| = 3. Do this for all the elements and find out the maximum and print it.Upon thinking, I came out with the brute-force (O^n2) solution by travelling to the left and right of the element for all the elements in the array. This was ineffecient. So, I quickly realized the importance of ‘nearest’ and thought along the lines of using a stack to maintain the order. I used two stacks, lstack and rstack to store the nearest indices.https://www.geeksforgeeks.org/find-maximum-difference-between-nearest-left-and-right-smaller-elements/

- Given an array of integers, find the peak element in less than O(n) time.

https://www.geeksforgeeks.org/find-a-peak-in-a-given-array/

They selected 6 out of 18 after this round.