Unique Integers in Sorted List
Given a list of sorted integers nums
return the number of unique integers in the list.
Contraints
n ≤ 1,000,000
wheren
is the length ofnums
Notes
- \(\mathcal{O}(n)$` is accepted but `$\mathcal{O}(k\log{}n)\) is encouraged.
https://binarysearch.com/problems/Unique-Integers-in-Sorted-List
Examples
Example 1
Input
- nums =
[2, 2, 2, 3, 4, 6, 6]
Output
- answer =
4
Explanation
The unique numbers are [2, 3, 4, 6]
Leave a comment