Loop for remaining indexes
while ( stk . size ( ) != 0 ) { minarr [ stk . peek ( ) ] = n ; stk . pop ( ) ; } Vector < Integer > submin = new Vector < Integer > ( ) ; for ( int i = 0 ; i <= n - y ; i ++ ) {