A - All Distinct
CodeChefOpen on judge ↗
You are given an array $a$ of length $n$ and an integer $k$. The array $a$ contains at least one occurrence of each integer from $1$ to $k$. All the elements of $a$ are in the range $[1, k]$. We call the array $a$ *good* if it contains at least one subarray of length $k$ such that all its elements are distinct. Formally, $a$ is called *good* if and only if there exists an integer $i$ such that:
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