If count of characters used from a particular group of characters has not exceeded m
else low = indexes [ it ] + 1 ; } return true ; } static int lower_bound ( List < int > indexes , int k ) { int low = 0 , high = indexes . Count - 1 ; while ( low < high ) { int mid = ( low + high ) / 2 ; if ( indexes [ mid ] < k ) low = mid + 1 ; else high = mid ; } return ( indexes [ low ] < k ) ? low + 1 : low ; }