How Many Maximums
From an array $A$ containing $N$ integers, you construct a binary string $S$ of length $(N - 1)$ as follows. For all $1 \le i \lt N$: - If $A_i < A_{i+1}$, then $S_i = 0$. - If $A_i > A_{i+1}$, then $S_i = 1$. Given the string $S$, determine the count of indices $i$ $(1 \le i \le N)$ such that it is possible for $A_i$ to be the **maximum** element of the array $A$. ### Input - The first line con
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