You are on page 1of 6

Uber

Interview Experience 1:
Round 1 - Online Assessment Test

(60 minutes)

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 towards 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 number 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 i and 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 minutes)

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-spanni
n g-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 a N2 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 a pseudo-critical edge. The interview then came to a close.
Round 3 - Technical interview 2

(45 minutes)

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.
Interview Experience 2:

Round 1 - Online assessment

(45 minutes)

The assessment was held on codesignal and had 3 problems to be solved in 90


minutes which was same as in the following link:
https://www.geeksforgeeks.org/uber-interview-experience-for-sde-1-2022-2/
Doing 2 completely correct and 1 partial was sufficient to qualify for the
interviews.

Round 2

(45 minutes)

This was also held in the codesignal platform in virtual mode via zoom meet. Duration

was 45 minutes. Screen was to be shared in the meet for the full duration of the

interview. In this round, only one problem was asked.

Given a graph G with n nodes and list of edges E, print all the edges which are critical
edges. An edge is called a critical edge if and only if it is present in all possible minimum
spanning trees of the given graph. In other words, if removing a particular edge from the
list E results in a graph which has more value of the MST than the given graph G or the
graph becomes disconnected, then that edge is called a critical edge.

Note: It is guaranteed that the given graph is connected.

Coming up with an O(|E|2) was fine. I took so much time to think about some linear or
|E|log(|E|) solution but ended with the |E|2 solution and hence could not get time to
code. But the interviewer was expecting that |E|2 solution only.
Round 3

(45 minutes)
The platform, duration and everything was same. This round was based on OOPs
concepts. The problem was the following.

Given that a restaurant has many dishes and each dish has a name, some
ingredients(can be more than one), price and applicable GST(in %), design the following
functions:

1). Make a function to add dishes in the system given the list of ingredients, price and
other information.

2). Given an ingredient list, return list of dishes with that ingredient.

3). Given a list of ingredients, return list of dishes in which all/more than one/exactly one
of the given ingredients are present.

4). Given a list of dishes, calculate the bill amount.

5), Change your system to allow the user to add different dishes with same
name. The differentiating factor can be anything like price/GST/Ingredients.

6). Given a list of dishes, return all the ingredients present in it without repetitions

The interview lasted for exactly 45 minutes. He kept adding to the list of functionalities
that my system should have until 45 minutes were over.

Round 4

This was an HR round which lasted for around 25-30 minutes. The interviewer was
asking some general questions.

● Field of interest in Computer Science

● Projects (Why you choose this one? What challenges did you face) ● Teamwork (Did
you have conflict in your team projects? Do you like to work in team or alone and
why?)
● Some OOPs concepts like Abstraction, polymorphism, Encapsultion.(Only definitions and
examples).
● What are public and private variables in OOPs? What is the difference between
these two. Why are they needed?

You might also like