kotlin-coding-challenges

Count unique values

Instructions

Given a sorted list of integers implement a function which counts the unique values.

Challenge Solution

Examples

countUniqueValues([]) // 0

countUniqueValues([1, 1, 6]) // 2

countUniqueValues([-2, -1, -1, 0, 1]) // 4