Uber interview experience Real time questions & tips from candidates to crack your interview

SDE - 1

Uber
upvote
share-icon
1 rounds | 3 Coding problems

Interview preparation journey

expand-icon
Journey
This was a college placement drive arranged.I attended it and gave my best. I only got into the first round. I must have practiced more. This was a good opportunity to understand where i stood.
Application story
This was a placement drive to which I applied. This drive was for my 10th sem intern. we were prepared by college by it.
Why selected/rejected for the role?
I was not selected for this role, maybe should have tried harder. I only went till 1st round didn't go further.
Preparation
Duration: 3 months
Topics: Data structures, Algorithm, OOPS, Pointers, Algorithms
Tip
Tip

Tip 1 : Practice competitive programming regularly
Tip 2 : Look at interview experience
Tip 3 : Talk to seniors who work there

Application process
Where: Campus
Eligibility:
Resume Tip
Resume tip

Tip 1 : Get it reviewed by professional
Tip 2 : Mention only what you know

Interview rounds

01
Round
Easy
Online Coding Interview
Duration90 minutes
Interview date12 Jan 2023
Coding problem3

1. Remove Edges

Moderate
20m average time
80% success
0/80
Asked in companies
FacebookUber

You are given an undirected graph with ‘N’ vertices and ‘M’ edges. Each edge has a particular type as described below:

An edge with type 1 can only be traversed by a person ‘A’.

An edge with type 2 can only be traversed by a person ‘B’.

An edge with type 3 can be traversed by both persons ‘A’ and ‘B’.

Your task is to determine the maximum number of edges that can be removed such that after removing these edges, all the nodes can still be traversed by both ‘A’ and ‘B’.

Problem approach

We can solve this problem using DFS. One simple solution is to delete each edge one by one and check subtree sum difference. Finally choose the minimum of them. This approach takes quadratic amount of time. An efficient method can solve this problem in linear time by calculating the sum of both subtrees using total sum of the tree. We can get the sum of other tree by subtracting sum of one subtree from the total sum of tree, in this way subtree sum difference can be calculated at each node in O(1) time. First we calculate the weight of complete tree and then while doing the DFS at each node, we calculate its subtree sum, by using these two values we can calculate subtree sum difference.

Try solving now

2. GCD Sum

Hard
35m average time
55% success
0/120
Asked in companies
AdobeDunzoQuikr

Consider all numbers from 1 to ‘N’, your task is to find the sum of gcd of all pairs (i, j) such that 1 <= i < j <= N.

For example for N = 3, all pairs are { (1, 2), (1, 3), (2, 3) }.

Note :

Gcd of two numbers (X, Y) is defined as the largest integer that divides both ‘X’ and ‘Y’. 
Problem approach

# Python program to print all
# primes smaller than or equal to
# n using Sieve of Eratosthenes


def SieveOfEratosthenes(n):

# Create a boolean array
# "prime[0..n]" and initialize
# all entries it as true.
# A value in prime[i] will
# finally be false if i is
# Not a prime, else true.
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):

# If prime[p] is not
# changed, then it is a prime
if (prime[p] == True):

# Update all multiples of p
for i in range(p * p, n+1, p):
prime[i] = False
p += 1

# Print all prime numbers
for p in range(2, n+1):
if prime[p]:
print(p)


# Driver code
if __name__ == '__main__':
n = 20
print("Following are the prime numbers smaller"),
print("than or equal to", n)
SieveOfEratosthenes(n)

Try solving now

3. Next Greater Element

Easy
10m average time
90% success
0/40
Asked in companies
FlipkartAmazonGroww

You are given an array 'a' of size 'n'.



The Next Greater Element for an element 'x' is the first element on the right side of 'x' in the array, which is greater than 'x'.


If no greater elements exist to the right of 'x', consider the next greater element as -1.


For example:
Input: 'a' = [7, 12, 1, 20]

Output: NGE = [12, 20, 20, -1]

Explanation: For the given array,

- The next greater element for 7 is 12.

- The next greater element for 12 is 20. 

- The next greater element for 1 is 20. 

- There is no greater element for 20 on the right side. So we consider NGE as -1.
Problem approach

# Function to print element and NGE pair for all elements of list
def printNGE(arr):

for i in range(0, len(arr), 1):

next = -1
for j in range(i+1, len(arr), 1):
if arr[i] < arr[j]:
next = arr[j]
break

print(str(arr[i]) + " -- " + str(next))


# Driver program to test above function
arr = [11, 13, 21, 3]
printNGE(arr)

# This code is contributed by Sunny Karira

Try solving now

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

Which SQL keyword removes duplicate records from a result set?

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
1 rounds | 3 problems
Interviewed by Uber
0 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 4 problems
Interviewed by Uber
968 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 3 problems
Interviewed by Uber
716 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 5 problems
Interviewed by Uber
3322 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
107832 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
52130 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
32261 views
6 comments
0 upvotes