Maximize the division result of Array using given operations | Function to find the max result ; Sort the array in descending order ; Loop to divide in this order arr [ 0 ] / ( arr [ 1 ] / arr [ 2 ] / ... . arr [ n - 2 ] / arr [ n - 1 ] ) ; Return the final result ; Driver code
def maxDivision ( arr , n ) : NEW_LINE INDENT arr . sort ( reverse = True ) NEW_LINE mxdiv = arr [ 1 ] NEW_LINE for i in range ( 2 , n ) : NEW_LINE INDENT mxdiv = mxdiv / arr [ i ] NEW_LINE DEDENT return arr [ 0 ] / mxdiv NEW_LINE DEDENT arr = [ 100 , 1000 , 10 , 2 ] NEW_LINE n = len ( arr ) NEW_LINE print ( maxDivision ( arr , n ) ) NEW_LINE