As reported: Cisco online assessment (2026, on-campus; the Technical Intern 2027 OA had 90 minutes for 42 questions — 20 MCQs, 2 coding questions and 20 subjective CS-fundamentals questions): Drone Delivery with Battery Swap Stations.
A drone fleet flies over an urban grid. Each drone goes from a depot to a customer, but its battery cannot always cover the whole distance. Some rooftops have battery-swap kiosks: when the drone arrives over a kiosk it can instantly swap in a fully charged battery — but only if it still has an unused swap voucher. Vouchers are scarce: there are K for the whole trip.
gridisrows × cols:0= open airspace,1= no-fly building.- The drone starts at the depot
start = [sr, sc]and must reach the customerend = [er, ec](both open cells). - Each move goes up, down, left or right to an open cell and uses 1 unit of battery. The battery holds
Bunits and starts full; the drone cannot move with an empty battery. kioskslistsMdistinct open cells with swap kiosks.
Return the minimum number of moves from depot to customer, or -1 if no feasible delivery exists.
Example 1
grid = [[0,0,0,0,0],
[0,1,1,1,0],
[0,0,0,1,0],
[1,1,0,0,0]]
start = [0,0], end = [3,4], B = 4, kiosks = [[2,2]], K = 1 -> 7
Both 7-move routes are too long for one battery. Going down the left side reaches the kiosk at [2,2] after 4 moves with an empty battery, swaps (using the voucher), and finishes in 3 more moves.
Example 2
same grid, start = [0,0], end = [3,4], B = 4, kiosks = [[2,2]], K = 0 -> -1
Constraints: 1 ≤ rows, cols ≤ 30; 1 ≤ B ≤ 60; 0 ≤ M ≤ rows · cols; 0 ≤ K ≤ 3; coordinates are 0-indexed.
Code runner format: one JSON value per line: grid, start, end, B, kiosks, K. Implement minDeliveryMoves(grid, start, end, battery, kiosks, vouchers); the harness prints the number of moves.
Clarifications
- Swapping is optional and takes no moves; it happens on arriving at a kiosk cell and resets the battery to
B. - Reaching the customer with an empty battery is fine.
- If the depot is the customer, the answer is
0.