← All problemsSign in

Chef and Finding Direction

CodeChefRating 2662Open on judge ↗

Chef has a grid of size N * N with its rows numbered from 1 to N, and the columns also numbered from 1 to N. The cell at the ith row and the jth column is cell (i,j). From cell (i,j), you can go in one of the four directions U L D R (corresponding to up, left, down, right) to cells (i-1,j), (i,j-1), (i+1,j), (i,j+1) respectively, and of course you cannot go outside of the grid. However, with each

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