← All problemsSign in

Hungry Alan

Alan is in a 2-dimensional maze with n rows and m columns and he needs to travel from 0,0 to n-1,m-1. A cheese block is kept in one of the paths from 0,0 to n-1,m-1. Alan can move in any direction (North, South, East, West). He can only move through cells that are numbered 1 and 2 and cannot go through the cells that are numbered 0. There is at max one cell in the maze which is numbered 2 repr

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