← All problemsSign in

Chef and The Recursive Algorithm

CodeChefRating 3176Open on judge ↗

There is a RxC grid where the rows are numbered by integers from 1 to R from top to bottom and columns are numbered by integers from 1 to C from left to right. Two cells of the grid are called adjacent if they share a common side. Chef uses an algorithm which starts at a cell (sr,sc) of the grid and visits the unvisited adjacent cells inside the grid recursively. The order in which the adjacent

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