Prefix Sum Array for X + 1 digit
let prefix = new Array ( size1 ) ; for ( let j = 0 ; j < size1 ; j ++ ) { prefix [ j ] = 0 ; if ( newtest [ j ] . charCodeAt ( 0 ) == y + 48 ) { prefix [ j ] ++ ; } } for ( let j = 1 ; j < size1 ; j ++ ) { prefix [ j ] += prefix [ j - 1 ] ; } let count = 0 ; let firstcount = 0 ;