Practice · 4 of 6
Backward-looking dedup
CHALLENGE
Difficulty: intermediate+25 XP
Implement int countDistinct(int[] arr): number of distinct values. The pairwise backward scan (j < i, break on first match) is allowed and expected. Empty array → 0.
Press Submit to check your solution.
Back to lesson: Practice: Array lab