Binary String Game
We define a function $f$ on a binary string $S$ of length $N$ as follows: $f(S) = \sum_{i = 1}^{N - 1} |S_{i+1} - S_{i}|$. JJ and Uttu have a binary string $S$ of length $N$ and they decide to play a game using it. The rules of the game are as follows: - JJ starts the game with players making moves in alternate turns thereafter. - In one move, a player can pick $L, R$ such that $1 \leq L \leq R
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