← All problemsSign in

Moving Inside Grid

# Moving Inside Grid Consider a grid A of size N. Starting from the index 0, your goal is to reach N−1 in exactly M moves. It’s your choice to move forward or backward by steps that are equal to a prime divisor of the content of the cell you are currently at. You cannot move beyond the grid in any case. Write a program to find whether it is possible to reach index N−1 in M moves. # Input forma

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