Function to return the minimum number of operations required to convert the given array to an increasing AP series with common difference as 1
function minOperations ( arr , n ) { var start = arr [ n - 1 ] ; var end = arr . reduce ( ( a , b ) => Math . max ( a , b ) ) + n ; var max_arr = 0 ;