Max Min and Length
An array $B$ of size $M$ is said to be *good* iff $\max(B_i) - \min(B_i) = M$, i.e., the difference between maximum and minimum elements of the array is equal to its length. Given an array $A$ consisting of $N$ **distinct** integers, count the number of *good* subsequences $^{\dagger}$ of the array $A$. $^{\dagger}$ An array $P$ is said to be a subsequence of $Q$ if we can obtain $P$ by deleti
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