Function that traverses digits in a number and modifies frequency count array
function countDigits ( val , arr ) { while ( val > 0 ) { let digit = val % 10 ; arr [ digit ] ++ ; val = Math . floor ( val / 10 ) ; } return ; } function countFrequency ( x , n ) {