Gritty Grid
Alice and Bob are trapped in a grid having $N$ rows and $M$ columns. Alice is currently at cell $(1, 1)$ and Bob is at cell $(N, M)$ and they both want to meet each other at any common cell. But they have some restrictions in the way they can move and meet: A _step_ is defined as moving to an adjacent cell from the current cell that the person is in. So in a single step, if a person is at $(X, Y)
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.
Sign in to chat with the tutor and save your progress.
Sign in to start