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

Open Count Distinct (Sorted) in Code Arena →