Minimize Error
There exists a hidden array $A$ of length $N$ such that there is an integer $X$ ($1 \le X \le N$) satisfying - $A_i = 0$ for $i < X$ - $A_i = 1$ for $i \ge X$ In other words, the array consists of some number of $0$'s followed by only $1$'s, and $X$ is the position of the first $1$. In particular, $A$ definitely contains at least one occurrence of the value $1$. You do not know anything else
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