HARDasked at 1 company

Time to Cross a Bridge

A hard-tier problem at 44% community acceptance, tagged with Array, Heap (Priority Queue), Simulation. Reported in interviews at LinkedIn and 0 others.

Founder's read

You're in a LinkedIn OA and hit this hard problem. The acceptance rate is 43 percent, which means it weeds people out fast. The trick isn't obvious: you need to simulate the bridge crossing while tracking which worker pair minimizes time, and a naive greedy approach will fail. This is a simulation problem disguised as optimization. If you haven't drilled heap-based scheduling, you'll blank. StealthCoder solves it invisibly in seconds if you hit it live and freeze.

Companies asking
1
Difficulty
HARD
Acceptance
44%

Companies that ask "Time to Cross a Bridge"

If this hits your live OA

Time to Cross a Bridge is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE.

Get StealthCoder
What this means

The naive solution tries to send workers across in a greedy order, but that's slow. The real pattern: use a min-heap to track worker times, simulate each crossing state, and compare two strategies at each step: either the fastest worker shuttles everyone back, or two fast workers go and one returns. You'll iterate through all possible states and track the cumulative time. The heap keeps you from recalculating min times on every iteration. Most candidates either miss the two-strategy comparison or implement the simulation incorrectly and run out of time. When you're in the live OA and realize your greedy pass doesn't match the expected output, StealthCoder runs invisible to your screen share and shows the working simulation approach.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Time to Cross a Bridge recycles across companies for a reason. It's hard-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Time to Cross a Bridge interview FAQ

Is 'Time to Cross a Bridge' really hard or just long?+

It's genuinely hard. The 43 percent acceptance rate reflects that the simulation logic isn't intuitive. You can't brute-force it. The heap and state-comparison pattern separates people who've seen bridge-crossing problems before from those who haven't. It's longer than medium problems, yes, but the difficulty is algorithmic, not implementation.

Do I really need a heap for this?+

Yes. Without a heap, you're repeatedly scanning to find the minimum time worker, which makes your simulation quadratic or worse. A min-heap keeps extraction and reinsertion at log N. Since you're simulating crossings and the heap changes after each move, it's critical.

What's the trick that most people miss?+

The two-strategy comparison. At each state, you either send the two fastest first and then shuttle back, or send the slowest pair with one fast worker. Candidates often lock into one greedy strategy and never explore both paths. The simulation has to compare them and pick the minimum cumulative time.

Does LinkedIn ask this often?+

It's reported once in our data, but that's one confirmed report. Hard problems like this appear in their rounds, so if simulation and heap are on your weak list, this pattern is worth studying before their OA.

How does this relate to the Array and Simulation topics?+

The bridge state is represented as an array (or list) of workers with their crossing times. Simulation means you iteratively compute the next state, updating the array and cumulative time. The heap is the data structure that makes the simulation efficient. All three topics thread together.

Want the actual problem statement? View "Time to Cross a Bridge" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.