A grid has open cells (0) and obstacles (1). You start at the top-left cell and want to reach the bottom-right cell, moving up, down, left or right one step at a time. You may walk through at most k obstacles (each obstacle cell you step onto uses one removal). Return the minimum number of steps, or -1 if it is impossible.
- The start cell is open in the tests
- A 1 x 1 grid needs
0 steps - The state is not just the cell: how many removals you have used matters
- Up to a 40 x 40 grid and
k up to 1600 should still be fast