← Uber Interview Insights

Uber·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Jun 2026

Summary

Interviewed for a software engineer role at Uber, two algorithm questions back to back. Both were pretty meaty and required thinking through binary search and dynamic programming under time pressure. Felt okay about the first one, shakier on the second.

Questions Asked (2)

Q1

You have an array of vault sizes and a time limit in hours. A robber can steal up to k units per hour from one vault at a time, and a vault of size v takes ceil(v/k) hours to empty. Find the minimum integer rate k such that all vaults can be emptied within the given number of hours.

Algorithms & Data Structures
Author's notes

Classic binary search on the answer, which I did recognize pretty quickly.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Recognize this as a binary search on the answer problem: the feasibility of a given rate k is monotonic (if k works, any larger rate also works). Define a helper function that checks if sum(ceil(v/k)) <= h, then binary search the smallest k in the range [1, max(vaults)].

Pro tip: Mention that the upper bound can be max(vaults) because k=1 is the slowest possible rate, and if k >= max(vaults) each vault takes at most 1 hour, so if h >= number of vaults, max(vaults) is always feasible. Also note that using integer arithmetic for ceil division avoids floating-point errors.

1. Clarify the problem and constraints

Restate the problem: given an array of vault sizes and a time limit h, find the minimum integer rate k (units per hour) such that the total hours needed, sum(ceil(v/k)), is at most h. Confirm edge cases like empty array, h less than number of vaults, and large values.

2. Define the feasibility check

Write a function feasible(k) that computes the total hours required at rate k: sum over vaults of ceil(v/k). Use integer arithmetic: (v + k - 1) // k. Return true if total <= h.

3. Identify monotonicity and binary search bounds

Observe that if rate k is feasible, any rate > k is also feasible. Set lower bound low = 1 and upper bound high = max(vaults) (or sum(vaults) if h is very small, but max is sufficient because at k = max(vaults), each vault takes at most 1 hour).

4. Perform binary search

While low < high, compute mid = (low + high) // 2. If feasible(mid), set high = mid; else set low = mid + 1. Return low as the minimum feasible rate.

5. Analyze complexity and test

Time complexity: O(n log(max(vaults))), space O(1). Walk through a small example to verify correctness, and discuss potential overflow if sums are large (use 64-bit integers).

Key Points to Mention

  • Binary search on the answer (rate k) because feasibility is monotonic.
  • Feasibility check: sum of ceil(v/k) <= h, computed efficiently with integer arithmetic.
  • Upper bound for binary search: max(vaults) (or sum(vaults) if h is very small).
  • Time complexity: O(n log(max(vaults))), which is efficient for large inputs.
  • Edge cases: h < number of vaults (impossible), empty array, large vault sizes causing overflow.
  • Use of integer division to avoid floating-point precision issues.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Given a set of integers and a target value, determine whether any subset of the integers sums exactly to the target. Return true or false.

Algorithms & Data Structures
Author's notes

Subset sum.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem constraints (e.g., input size, whether negative numbers are allowed, memory limits). Then propose a dynamic programming solution using a boolean array to track achievable sums, and discuss trade-offs with other approaches like recursion with memoization or meet-in-the-middle. Finally, analyze time and space complexity and consider optimizations for the specific constraints.

Pro tip: Mention that the DP can be optimized to use a 1D array and iterate backwards to avoid reusing elements, and discuss how to handle large targets with bitset or meet-in-the-middle. This shows awareness of practical performance concerns.

1. Clarify constraints and edge cases

Ask about input size, range of integers, whether negative numbers are allowed, and if the target can be zero. This determines the best algorithm and prevents incorrect assumptions.

2. Choose an algorithm

For small n and target, use DP with a boolean array; for large n but small target, DP is still good; for large target and moderate n, consider meet-in-the-middle. Discuss trade-offs.

3. Implement the solution

Write clean code for the chosen approach, handling edge cases like empty set or target 0. For DP, initialize dp[0]=true and iterate through numbers, updating dp from target down to num.

4. Analyze complexity and optimize

State time and space complexity (e.g., O(n*target) time, O(target) space for DP). Mention optimizations like bitset or pruning for large targets.

5. Test with examples

Walk through a small example to verify correctness, including cases where the subset exists and where it doesn't. Mention potential pitfalls like integer overflow.

Key Points to Mention

  • Dynamic programming with a boolean array to track achievable sums
  • Time complexity O(n * target) and space complexity O(target) for 1D DP
  • Handling negative numbers by offsetting the target or using a set
  • Meet-in-the-middle approach for large target values with moderate n
  • Edge cases: empty set, target 0, duplicate numbers
  • Optimization using bitset for faster operations in languages like C++

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.