Practice · 3 of 5
Longest All-Distinct Window
CHALLENGE
Difficulty: intermediate+25 XP
**Description:** Print the length of the longest contiguous window with all
distinct values.
**Input:** Line 1: n (1 <= n <= 200000). Line 2: n integers (0 <= a[i] <= 10^6).
**Output:** One integer — the longest all-distinct run.
**Example:** 6 / 1 2 3 1 2 3 -> 3.
Press Submit to check your solution.
Back to lesson: Practice: Two Pointers Problem Set