Increase totCount at exterior position
totCount [ index + k * n ] ++ ; } now = 0 ; totCount [ k * n ] -- ; for ( int j = 1 ; j <= n ; j ++ ) { if ( s [ j - 1 ] == '1' ) now ++ ; int index = j - k * now ;