Count Distinct (Sorted)
Medium · rating 1200 · Two Pointers, Arrays
The first line contains n. The second line has n integers in non-decreasing order. Print how many distinct values there are.
Constraints: 1 ≤ n ≤ 105
Related problems
- Two Sum (Sorted) — Medium
- Move Zeroes — Easy
- Longest Equal Run — Medium
- Missing Number — Medium
- Most Frequent Element — Medium
- Second Largest — Medium