Increase the count in array if a character is found
for ( let i = 0 ; i < n ; i ++ ) { count [ str [ i ] . charCodeAt ( 0 ) ] ++ ; } let max_distinct = 0 ; for ( let i = 0 ; i < NO_OF_CHARS ; i ++ ) { if ( count [ i ] != 0 ) { max_distinct ++ ; } } return max_distinct ; } function smallesteSubstr_maxDistictChar ( str ) {