← All problemsSign in

D - Grid Walk

Given an integer grid of size $N\times N$ where a cell in $i^{th}$ row and $j^{th}$ column is specified by pair $(i, j)$, both $0$-indexed. Some cells have obstacles denoted by -1. You are initially at the cell $(0, 0)$ and you can walk in the grid using following rules - - From a cell $(i, j)$ you can move only up, left, right, down one adjacent cell. - You can visit a cell multiple times b

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start