Count Partitions
An array $B$ of length $M$ consisting of only **distinct** elements is said to be *good* if the following condition holds: - Let $i$ be the index of the maximum element of $B$. - Then, $B[1,i]$ must be in ascending order, i.e, $B_1 \lt B_2 \lt B_3 \lt \ldots \lt B_i$. For example, $[1, 2, 3], [1, 4, 3, 2]$ and $[1, 3, 2]$ are *good* arrays, while $[2, 1, 3]$ and $[3, 2, 4, 1]$ are not. You are g
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