Twice Greater
An array $B$ of length $M$ is called *good* if $2 \cdot B_i < B_{i + 1}$ for all $1 \le i < M$. For example, $[1, 3]$ is good, but $[1, 2]$ and $[1, 2, 3]$ are not. --- For a **sorted** array $B$, we define $f(B)$ to be the length of the longest good subsequence of $B$. For example, for the array $B = [1, 2, 3]$, $f(B) = 2$ as obtained by the subsequence $[1, 3]$. --- You are given a **sorted*
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