Finding the shortest prefix such that all the elements in the prefix are less than or equal to the elements in the rest of the array .
int partitions = 0 ; for ( int current_max = arr [ 0 ] , i = 0 ; i < n ; i ++ ) { current_max = max ( current_max , arr [ i ] ) ;