← All problemsSign in

Minimum OR Path

CodeChefRating 2502Open on judge ↗

Harasees has an array $A$ of size $N$ containing non-negative integers. He starts at the index $1$ of $A$ and wants to reach the index $N$. In one move, he can do the following: - If he is currently at index $i$, then he can move to any index $j$ such that $i \le j \le \min(i + A_i, N)$. The cost of a path is defined as the [bitwise OR](https://en.wikipedia.org/wiki/Bitwise_operation#OR) of all

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