Grid with obstacles

Asked atMicrosoft
1Give yourself 5 minutes
2Answer out loud, not in your head
3Then compare with the answer below
0
Stuck? Show a way to structure it+
  1. 01Clarify allowed moves and whether the task counts paths or optimizes a score
  2. 02Represent blocked cells as unreachable rather than ordinary zero-valued cells
  3. 03Define a state for the current cell and transitions from legal predecessors
  4. 04Initialize the start and boundary cells carefully
  5. 05Compress to one row only after preserving the above-cell value

Reference answer

Then expect these follow-ups

  • What constraint would change your chosen approach?

    Tests: constraint adaptation

  • How would you test the edge cases before implementation?

    Tests: implementation extension

Free to read · better with Enzo

Practice this out loud with Enzo

Enzo runs it as a mock interview, pushes back with follow-ups, and grades you on the rubric.

Next question