Fewest Moves Across a Grid with a Wall-Breaking Budget

Asked at Apple · Coding Questions · Difficulty: Hard

A robot must cross a rectangular grid from the top-left cell to the bottom-right cell. Some cells are walls. The robot carries a limited number of charges, and each charge lets it break through one wall. Find the fewest moves the robot needs, or report that the trip is impossible.

Loading the problem…