Movement in Array
CodeChefOpen on judge ↗
Consider an array $A$ of size $N$. You start from the index 0 and your goal is to reach index $N – 1$ in exactly $M$ moves. At any index, you can move forward or backward by a number of steps that is equal to a prime divisor of the value which exists at that index. You cannot go beyond the array while going forward or backward. Write a program to determine whether it is possible to reach index $
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