← NVIDIA Interview Insights

NVIDIA·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Got a classic puzzle-style question during what felt like a technical screen for a software engineering role at NVIDIA. Not the kind of thing I was expecting but in hindsight it makes sense they'd want to see how you reason through optimization problems under pressure.

Questions Asked (1)

Q1

Four people need to cross a bridge at night with one flashlight. At most two can cross at a time and the flashlight must be carried across (no throwing it back). Their individual crossing times are 1, 2, 5, and 10 minutes, and two people together move at the slower person's pace. What is the minimum time to get everyone across, and what sequence achieves it? Then generalize: given n people with crossing times t1 through tn, describe a strategy for finding the minimum total time.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I knew the specific instance from somewhere in the back of my brain, the answer is 17 minutes, but I fumbled explaining WHY for a solid two minutes.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, solve the specific instance by reasoning about the optimal strategy: the two slowest should cross together, and the fastest should shuttle the flashlight. Then, generalize by identifying the two candidate strategies (using the two fastest as shuttlers or using the fastest to escort the slowest) and choosing the cheaper one at each step, leading to a dynamic programming or greedy solution.

Pro tip: After presenting the solution, mention that this problem illustrates the importance of considering trade-offs between using the fastest person as a shuttle versus pairing slowest together, a common pattern in optimization problems.

1. Solve the specific instance

Work through the 1,2,5,10 case to find the minimum time (17 minutes) and the sequence: 1 and 2 cross (2), 1 returns (1), 5 and 10 cross (10), 2 returns (2), 1 and 2 cross (2).

2. Identify the two strategies

For any four people sorted by time, the optimal is either: (a) fastest shuttles: t1+t2 cross, t1 returns, t3+t4 cross, t2 returns, t1+t2 cross; or (b) fastest escorts: t1+t4 cross, t1 returns, t1+t3 cross, t1 returns, t1+t2 cross.

3. Generalize to n people

Sort times ascending. For the two slowest, compute the cost of both strategies and pick the cheaper. Remove them and repeat until 3 or fewer remain, then handle base cases.

4. Implement algorithm

Use a greedy approach: while n>3, compare cost1 = t1 + 2*t2 + tn and cost2 = 2*t1 + t_{n-1} + tn, add the smaller to total, and reduce n by 2. For n=3, total = t1+t2+t3; for n=2, total = t2; for n=1, total = t1.

5. Analyze complexity

Sorting takes O(n log n), and the loop runs O(n) times, so overall O(n log n) time and O(1) extra space.

Key Points to Mention

  • The optimal strategy often involves the two slowest crossing together to minimize their impact.
  • The two fastest people are used as shuttlers to return the flashlight.
  • For the general case, compare the cost of two strategies: (1) fastest two shuttle, (2) fastest escorts each slow person.
  • Base cases: n=1,2,3 have trivial solutions.
  • The algorithm is greedy and runs in O(n log n) due to sorting.
  • This problem demonstrates trade-offs between different optimization strategies.

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