Linear Warehouse Drone Delivery
Reported by candidates from Capital One's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Capital One reported this one in September 2026, and the title sounds fancier than it is. Linear Warehouse Drone Delivery is a simulation on a number line, and the whole thing hinges on one data structure: a sorted list of stations you can binary search. If your OA is in the next couple of days, this is the kind of problem that looks like a story and turns out to be a loop. Stations arrive unsorted, the target can reach a billion, and one off-by-one on the drone range will fail the hidden tests. StealthCoder is there as a safety net if you blank on the live OA.
The problem
You are designing a delivery system that uses drones in a linear warehouse. The warehouse is a number line that starts at position 0 and ends at position target. Charging stations are placed at the positions in stations. A fully charged drone can carry the cargo at most 10 units to the right. For example, a drone launched at position 12 can reach any position through 22, inclusive, but cannot reach position 23. Starting with the cargo at position 0, repeat this protocol until it reaches target: Carry the cargo on foot from its current position to the nearest charging station at or ahead of that position. If there is no such station before the target, carry the cargo directly to target. Launch a fully charged drone from that station and send the cargo as far as possible toward target, up to 10 units. If the target has not been reached, walk to the position where the drone landed, retrieve the cargo, and repeat. Return the total distance over which the cargo is carried on foot. Walking performed without the cargo is not included. Function solution(target: int, stations: int[]) → int Examples Example 1 target = 23 stations = [7,4,14] return = 4 Carry the cargo from 0 to station 4, adding 4. The drone carries it to 14. A drone can then launch from station 14 and reach 23, so no more cargo-carrying on foot is needed. Example 2 target = 25 stations = [20,10,0] return = 0 The cargo begins at station 0. Drones launched from stations 0, 10, and 20 carry it all the way to the target, so the cargo is never carried on foot. Example 3 target = 28 stations = [25,3] return = 15 Carry the cargo 3 units to station 3, then the drone carries it to 13. Carry it another 12 units to station 25, whose drone reaches the target. The total is 3 + 12 = 15. Constraints 1 ≤ target ≤ 10^9 0 ≤ stations.length ≤ 10^5 0 ≤ stations[i] ≤ target
Reported by candidates. Source: FastPrep
Pattern and pitfall
Sort the stations first. Then simulate. Keep a position pos starting at 0. Find the first station at or ahead of pos with binary search or a moving pointer. If none exists before the target, walk to the target, add that distance, and stop. Otherwise add station - pos to the walked total, then set pos = station + 10. If pos reaches or passes target, you're done. Never step through units one at a time, because target goes up to 10^9. Jump between stations only. The classic pitfall is the landing spot. The drone lands at station + 10, and the next station may be exactly there, which costs 0 walking. Another trap is a station equal to pos, which also costs 0. Example 3 is a good test: 3 + 12 = 15. Each step either uses a station or ends, so it runs in O(n log n) from the sort. StealthCoder is the hedge if the live OA makes you second-guess the boundary cases.
If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.
You can drill Linear Warehouse Drone Delivery cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Capital One's OA.
Capital One reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Linear Warehouse Drone Delivery FAQ
What's the trick in Linear Warehouse Drone Delivery?+
Sort the stations, then jump from station to station instead of walking unit by unit. Each drone launch moves you 10 right. Add only the gap from your current position to the next station at or ahead of it. The target can reach 10^9, so a per-unit loop times out.
How hard is this Capital One OA question really?+
Easy to medium. There's no deep algorithm, just a careful simulation. Most failures come from boundary handling, like a station exactly at the landing point or no station left before the target. If you sort and trace the three examples by hand, you're mostly covered.
Do I need binary search or is a pointer enough?+
A moving pointer over the sorted array is enough and simpler. Since position only moves right, the next station index never goes backward. Binary search works too, but it adds code and bug surface for no real gain. Sorting dominates the cost either way.
What edge cases should I test before submitting?+
Test an empty stations list, which means you walk the whole target. Test a station at 0, a station exactly at the landing spot, and a station at the target. Also test duplicate stations. Example 2 covers the zero-walk case and Example 3 covers the final walk.
How do I prep for this in 48 hours?+
Practice simulation problems that jump between events on a sorted array. Write this one from scratch twice, then hand-trace all three examples. Focus on the loop's stop condition: pos >= target. Don't spend time on advanced structures, because this question doesn't need them.