MEDIUMasked at 6 companies

Car Fleet

A medium-tier problem at 53% community acceptance, tagged with Array, Stack, Sorting. Reported in interviews at Nutanix and 5 others.

Founder's read

Car Fleet is a medium-difficulty problem that shows up in real assessments at Nutanix, BNY Mellon, Snap, and other major companies. You're given positions and speeds of cars on a single lane, and you need to count how many actually reach the destination as independent fleets (not blocked by slower cars ahead). The trick isn't obvious on first read, and most candidates either brute-force it or miss the sorting insight entirely. If this problem hits your live OA and you blank on the pattern, StealthCoder solves it in seconds, invisible to the proctor.

Companies asking
6
Difficulty
MEDIUM
Acceptance
53%

Companies that ask "Car Fleet"

If this hits your live OA

Car Fleet 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. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code.

Get StealthCoder
What this means

The naive approach is to simulate each car's journey, but that's slow. The real insight: sort by position, then iterate backward through speeds. A car is its own fleet if it reaches the destination faster than the car ahead of it. Use a monotonic stack or just track the maximum time seen so far. If the current car's time is less than or equal to that max, it gets caught in the fleet ahead and doesn't count. This is a sorting and greedy problem dressed up as a simulation. The acceptance rate of roughly 53 percent reflects that the pattern doesn't announce itself. Stack or monotonic thinking applies here, but you don't need to build an actual stack. When you hit this live, StealthCoder gives you a working solution that handles edge cases you'd normally debug under pressure.

Pattern tags

The honest play

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

Car Fleet recycles across companies for a reason. It's medium-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. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Car Fleet interview FAQ

What's the trick to Car Fleet that most people miss?+

The key is sorting by position, then iterating backward to check if each car reaches the destination before the fleet ahead of it. Most candidates try to simulate forward or check collisions in the wrong order. Once you sort and reverse, the greedy check becomes linear.

Why does sorting help here?+

Sorting by position lets you process cars from destination backward toward start. This way, you know the time each car ahead needs, so you can immediately tell if the current car catches up or gets blocked. Without sorting, you'd need nested loops or complex state tracking.

Do I actually need a stack for this problem?+

A monotonic stack is one valid approach, but you can solve it with a single variable tracking the maximum time seen so far as you iterate backward. If the current car's travel time is less than that max, it's caught in a fleet. The stack is elegant but not required.

Is Car Fleet still asked at top companies?+

Yes. Recent reports place it at Nutanix, Snap, BNY Mellon, and others. It's not as common as some array problems, but it's frequent enough that you should recognize the pattern before your assessment. The 50 percent acceptance rate suggests it's being asked regularly.

How does Car Fleet relate to the sorting and stack topics?+

Sorting is the setup: it transforms an unordered input into a state where greedy logic works. The stack comes in when you want to maintain a decreasing sequence of fleet times. Either way, the pattern is recognizing that backward iteration and a single-pass check beat simulation.

Want the actual problem statement? View "Car Fleet" 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.