← Questions

Shortest path in a grid with obstacle elimination

0
MercorAppleCodingLast asked Sep 2026

A coding interview question asked in Mercor's technical phone screen and at Apple, last asked Sep 2026. It tests bfs, grids and shortest path.

A grid holds 0 for an empty cell and 1 for an obstacle. Starting at the top-left cell, find the fewest steps to the bottom-right cell, moving up, down, left or right one cell at a time, when you may remove up to k obstacles along the way.

Sign in to unlock this question

The full prompt, the worked answer and your own canvas or code with the AI tutor. New accounts get 5 credits: each one unlocks a question for good.

Where it's asked

What it tests

bfs · grids · shortest path

Your code and the AI tutor open when you unlock this question.