Function to minimize array
static void minimize ( int input [ ] , int n ) { Vector < Integer > arr = new Vector < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) arr . add ( input [ i ] ) ; while ( arr . size ( ) != 0 ) {