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 .
partitions = 0 NEW_LINE current_max = arr [ 0 ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT current_max = max ( current_max , arr [ i ] ) NEW_LINE DEDENT