Uber 2027 SWE Intern OA experience

uber logo
uber
July 14, 2026 · 2 reads

Summary

I completed Uber's 2027 SWE Internship online assessment, which had three coding questions; I solved two of them completely and partially solved the third.

Full Experience

Uber 2027 SWE Internship OA experience

I have recently given Uber online assessment for 2027 summer internship. Opportunity is through my college. This is the pattern of OA:

There are total 3 coding questions with 65 minutes time limit.

Problem-1 There are n cities, where each city has a delivery charge, given by the array deliveryCharge, and there are two possible ways of delivery:

  • Deliver with a cost of abs(deliveryCharge[i]-deliveryCharge[j]) or,
  • Deliver with a cost of 1 unit iff city j is closest city to city i

Distance between two cities is given by formula abs(deliveryCharge[i]-deliveryCharge[j]). And inputs are given such that each city has a closest city which is unique. (No city can have two closest cities)

Now array of queries is given where each query has [Start, End]. You have to give optimal cost to deliver from Start to End.

I did this in O(N+q) time and O(N) space complexity, and it was accepted.

Problem-2 There is a lane of length laneLength, think of it as a line segment from (0,0) to (laneLength, 0). And there are some trucks initially positioned at different coordinates on this lane and each truck travels with a velocity. Initial coordinates of trucks are given by initial and velocity of trucks by velocity. If velocity is positive, truck moves in right direction, else it moves in left direction. When a truck goes out of lane boundaries, it's considered to be left. And when two trucks collide, they exchange their velocities and directions also.

We have to output the time when last truck leaves the lane.

Problem-3 In a company, employees are organized in a hierarchical manner, this is represented in a tree. Root of the tree is boss. Children of a node are employees working under that node. Now when you pass data to a particular node (employee), it transfers to other employees in ascending order of node values who work under this employee.

Screenshot 2026-07-14 112354.png

In this example, if data is given to the root, it gets transferred in this manner, [11, 7, 3, 2, 4, 9, 8, 15, 13, 19].

Now array queries is given where each query has [StartNode, k]. You have to return who is kth person in order receiving data when data is first given to StartNode.

I was able to do this also. Here direct input of tree is not given, an array boss is given, where boss[i] is boss of employee i.

So in total I've done 2 questions, only partial testcases were passed for remaining question.

My opinion: It was a medium‑hard level OA, good understanding of DSA is required to solve questions.

Interview Questions (3)

1.

Minimum Delivery Cost Between Cities

Data Structures & Algorithms

There are n cities, each with a delivery charge given by the array deliveryCharge. To deliver from city i to city j you can either:

  • Pay abs(deliveryCharge[i] - deliveryCharge[j]), or
  • Pay 1 unit if city j is the unique closest city to city i (no ties).

The distance between two cities is defined as abs(deliveryCharge[i] - deliveryCharge[j]). You are given an array of queries, each query is [Start, End]. For each query you must output the minimum possible cost to deliver from Start to End.

Constraints guarantee that each city has a unique closest city.

Approach: I pre‑computed the closest city for every city, built a graph with two types of edges (cost 1 and cost equal to absolute difference), and answered each query using a combination of prefix/suffix minima, achieving O(N + Q) time and O(N) space.

2.

Time When Last Truck Leaves a Lane

Data Structures & Algorithms

A lane has length laneLength (from position 0 to laneLength). Several trucks are initially placed at positions given by the array initial. Each truck moves with a velocity given by velocity (positive → right, negative → left). When a truck reaches a lane boundary it leaves permanently. When two trucks collide they instantly exchange their velocities and directions.

You need to compute the exact time when the last truck exits the lane.

Approach: By modeling collisions as swaps of identities, the order of trucks does not affect exit times. For each truck, compute the time to reach the nearest boundary given its absolute speed and direction, then take the maximum of these times. This yields the answer in O(N) time.

3.

K‑th Person Receiving Data in a Hierarchical Tree

Data Structures & Algorithms

Employees form a tree hierarchy where the root is the boss. Children of a node are the employees that directly report to that node. When data is given to a node, it is transferred to its subordinates in ascending order of node values (i.e., IDs). For a given StartNode and integer k, return the ID of the k‑th employee who receives the data when the propagation starts from StartNode.

The tree is provided indirectly via an array boss where boss[i] is the direct manager of employee i (the root has no boss).

Approach: Build the adjacency list from the boss array, then perform a DFS/BFS from StartNode while always processing children in sorted order. Collect the visitation order and answer queries by indexing into this order.

📣 Found this helpful? Please share it with friends who are preparing for interviews!

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!