← All problemsSign in

Less than Max

An array $B$ of size $M$ is called *good* if for all $1 \le i \le M$, **either one** of the following conditions hold: - $B_i = 1$ - There exists $j$ such that $1 \le j < i$ and $B_j = B_i - 1$. --- Given an array $A$ of size $N$, find the size of the largest good subsequence $B$ of $A$. $B$ is said to be a subsequence of $A$ if it can be formed by deleting several elements from the array $A$

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