Skip to content

Uber Coding Questions 2025 - Interview Problems with Solutions

Uber coding interview questions with solutions. Practice DSA problems asked in Uber SWE interviews 2025.

Uber Coding Questions - Complete Problem Set

Section titled “Uber Coding Questions - Complete Problem Set”

Practice 25+ Uber coding interview questions with solutions. Uber focuses on geospatial problems and real-time systems.

1. Find Nearest Drivers (K Closest Points)

Section titled “1. Find Nearest Drivers (K Closest Points)”

Find k nearest drivers to a user’s location.

Input: drivers = [[1,3],[-2,2],[5,8],[0,1]], user = [0,0], k = 2
Output: [[-2,2],[0,1]]

Match riders to drivers optimally.

Calculate optimal surge multiplier based on supply/demand.

import heapq
from collections import defaultdict
def shortest_path(graph, start, end):
distances = {start: 0}
heap = [(0, start)]
parent = {start: None}
while heap:
dist, node = heapq.heappop(heap)
if node == end:
# Reconstruct path
path = []
while node:
path.append(node)
node = parent[node]
return path[::-1], dist
if dist > distances.get(node, float('inf')):
continue
for neighbor, weight in graph[node]:
new_dist = dist + weight
if new_dist < distances.get(neighbor, float('inf')):
distances[neighbor] = new_dist
parent[neighbor] = node
heapq.heappush(heap, (new_dist, neighbor))
return None, float('inf')

Predict arrival time considering traffic.

from collections import OrderedDict
class LRUCache:
def __init__(self, capacity):
self.cache = OrderedDict()
self.capacity = capacity
def get(self, key):
if key not in self.cache:
return -1
self.cache.move_to_end(key)
return self.cache[key]
def put(self, key, value):
if key in self.cache:
self.cache.move_to_end(key)
self.cache[key] = value
if len(self.cache) > self.capacity:
self.cache.popitem(last=False)
from collections import deque
def ladder_length(begin_word, end_word, word_list):
word_set = set(word_list)
if end_word not in word_set:
return 0
queue = deque([(begin_word, 1)])
visited = {begin_word}
while queue:
word, length = queue.popleft()
for i in range(len(word)):
for c in 'abcdefghijklmnopqrstuvwxyz':
new_word = word[:i] + c + word[i+1:]
if new_word == end_word:
return length + 1
if new_word in word_set and new_word not in visited:
visited.add(new_word)
queue.append((new_word, length + 1))
return 0
import heapq
def min_meeting_rooms(intervals):
if not intervals:
return 0
intervals.sort(key=lambda x: x[0])
heap = []
for start, end in intervals:
if heap and heap[0] <= start:
heapq.heappop(heap)
heapq.heappush(heap, end)
return len(heap)
class Codec:
def serialize(self, root):
def dfs(node):
if not node:
return ['null']
return [str(node.val)] + dfs(node.left) + dfs(node.right)
return ','.join(dfs(root))
def deserialize(self, data):
nodes = iter(data.split(','))
def dfs():
val = next(nodes)
if val == 'null':
return None
node = TreeNode(int(val))
node.left = dfs()
node.right = dfs()
return node
return dfs()
def max_subarray(nums):
max_sum = current_sum = nums[0]
for num in nums[1:]:
current_sum = max(num, current_sum + num)
max_sum = max(max_sum, current_sum)
return max_sum

Uber Preparation Guide

Complete preparation strategy. View Guide →


Practice geospatial + standard DSA for Uber!

Last updated: February 2026