Unique values counter using multiple-pointers pattern
// count the unique values in an array using the multiple-pointers pattern as shown
// the course JS Algorithms and Data Structures by Colt Steele on Udemy
function countUniqueValues(arr){
let i = 0
let j = 1;
while(j < arr.length){
if(arr[i] < arr[j]) arr[++i] = arr[j];
j++;
}
if (i === 0) return 0;
else return ++i;
}