# Uber Interview Experience for Summer Internship (On-Campus)

**Round 1 (Online Assessment Test) – 60 mins: **The first round comprised a coding test that was conducted on CodeSignal. This round contained three questions which are given below,

**Problem 1:**Conversion of numbers from base 2 to base 6. Link to the problem with a similar solution as mine: https://www.geeksforgeeks.org/convert-a-number-from-base-2-to-base-6**Problem 2:**Given a binary string of 0s and 1s, you can perform the following operation a finite number (possibly zero) of times: Choose a substring of length greater than or equal to K and flip all the bits of the substring. You have to find the maximum possible value of K such that after performing this operation a finite number (possibly zero) of times, you can make all the bits of the string equal.

**My Approach:** I devised an approach involving the application of a deque. I stored the lengths of the substrings with identical consecutive characters in the deque (001000110 -> 2 1 3 2 1). Then, until the size of the deque becomes one, I popped out the minimum value among the rightmost and the leftmost value and updated the answer as answer = min(answer, N – currentMinVal), where N is the length of the string (1 <= N <= 1e5), and then added this value to its neighbor in the deque (2 1 3 2 1 -> 2 1 3 3 -> 3 3 3 -> 3 6 -> 9). The answer for this case would be six since 9 – 3 = 6 (N = 9) is the minimum value among all the iterations. Some of my batchmates were able to solve this using binary search.

**Problem 3:**Bowling is a sport in which a player rolls a bowling ball toward a group of pins, the target being to knock down the pins at the end of a lane. In this challenge, the rules of the game are slightly modified. There are N numbers of pins, N is even, and the pins are arranged in a horizontal line instead of a triangular formation. The ith pin has the number arr[i] on it. In each throw, you have to knock down exactly two consecutive pins. Once you knock down pins at positions iIand i+1, those at i-1 and i+2 will become adjacent. And you’ll get arr[i-1]*arr[i]*arr[i+1]*arr[i+2] points for knocking the ith and i+1th pins down. If i-1 or i+2 goes out of bounds, assume that there is a pin with the number 1 at that position. Find out the maximum number of points one can get when played wisely. Since the answer can be large, return the answer modulo 1e9 + 7 as output.

**My Approach: **I don’t exactly remember the constraint on N, but I think it was around 1e2 since this problem is a variation of the burst balloons problem. Although I was able to figure this much out, I didn’t had enough time to implement it. So I did a brute force hardcoded solution, which helped me get around half of the points this problem was worth.

**Round 2 (Technical Interview 1) – 45 mins: **This round was conducted online on Zoom video call and CodeSignal. There were two interviewers on the call. In this round, I was given a LeetCode hard problem. Here is the link to the problem: https://leetcode.com/problems/find-critical-and-pseudo-critical-edges-in-minimum-spanning-tree

I was initially asked only to find the critical edges. I gave an exponential approach straight off the bat involving the generation of all possible trees. After some thought, I came up with an an^{2 }approach. The approach involved first finding the MST of the graph using Kruskal’s algorithm and then finding the MST without considering the current edge for each edge. If for any edge, the value of the MST deviates from the value of the actual MST, then that edge is critical. The interviewer was satisfied with this approach and asked me to start coding. I was able to implement the logic of the code but struggled a bit with the implementation of DSU. There were various silly mistakes in my code, which I could resolve towards the end. My code finally worked in the last minutes, and the interviewer then asked me a follow-up question to modify my code to find the pseudo-critical edges. I added a condition according to which if the MST value after removing the current edge didn’t change, then that edge is pseudo-critical. The interview then came to a close.

**Round 3 (Technical Interview 2) – 45 mins: **This round was also conducted online on Zoom video call and CodeSignal. There were again two interviewers. In this round, I was given an OOPs question and was told that this round focuses on the style of coding and the time complexities involved do not matter. I was asked to implement a data structure containing all the names, ingredients, and prices of a restaurant’s dishes. The data structure was required to provide the following functionality,

- Add new dishes.
- Print all the dishes currently present.
- Given a list of dishes, calculate the bill with 18% GST.
- Given a list of ingredients, print all the dishes which have at least one ingredient in common with the given list.
- Given a list of ingredients, print all the dishes which do not have any common ingredient with the given list.

I implemented all the functionality nicely using classes, sets, and vectors. I still had around 15 minutes left, so I was asked to come up with additional functionality,

- Given a final amount, print any list of dishes whose price sum up exactly to the given amount.

I wasn’t able to understand the question properly at the beginning. By the time I understood the question properly, the time was nearly up. Still, I was able to share my approach verbally, which involved a backtracking solution where for each dish, you either take the dish or don’t take the dish. The interviewer then asked me if I had any questions for him. I asked him about the culture at Uber. After he finished answering, the interview came to an end.

**Round 4 (Hiring Manager Interview) – 30 mins: **This round was also conducted on a Zoom video call.

- There was only one interviewer this time. I was first asked for a brief interview.
- The discussion then went toward projects. I was asked to choose one of the projects from my resume and briefly describe it. I chose a project which was based on Computer Architecture and described it. There were also some cross-questions in between, which I could answer. The discussion lasted for around 15 minutes, then the interviewer asked me about another one of my projects, and we discussed that.
- In the end, I was asked a question regarding my PORs, to share some instances where I either had helped someone or sought help from someone during my tenure. I answered the question, and the interviewer then asked if I had any questions for him. I asked him about his journey to Uber, and he answered briefly. The interview then came to an end.

**Final Verdict:** I received an offer from Uber.

## Please

Loginto comment...