← All problemsSign in

Chef And Lost Array

Chefina gifted Chef an array of $n$ numbers. Sadly, Chef lost this array and needs your help to recover it. Chef remembers that each array element was less than $2^{31}$. Chef also remembers the OR-value of $m$ ranges of the array. The OR-value of a range a[l,r] is defined as : a[l] | a[l+1] | . . . | a[r] . Chef would like the array values to be as large as possible. Since Chef is busy, he has

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