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