Function to return the minimum possible value of the last element left after performing the given operations
function getMin ( arr , n ) { var minVal = Math . min . apply ( Math , arr ) ; return minVal ; }