← All problemsSign in

Maximum Value (Hard Version)

You are provided with a binary string $S$ of length $N$. You have to choose a substring $G$ from $S$ having even length and divide it into the two equal parts $P1$ and $P2$ such that $P1$ will be the first half of $G$ and $P2$ will be the second. For some reason, reverse the part $P2$. There is a function $F(X)$, such that: $F(X)$ = $2*Len(P1) / (1 +$ $2^{|X|}$ $)$ Where: $X$ = Binary string for

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