This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| This algorithm challenge came up in Colt Steele's "JavaScript Algorithms and Data Structures" course: | |
| Implement a function called `countUniqueValues` which accepts a sorted array and counts the unique values in the array. | |
| There can be negative numbers in the array, but it will always be sorted. | |
| Example output: | |
| ``` | |
| countUniqueValues([1, 1, 1, 1, 1, 2]); // 2 | |
| countUniqueValues([1, 2, 3, 4, 4, 4, 7, 7, 12, 12, 13]); // 7 |