Split array into two subarrays such that difference of their maximum is minimum | Python3 Program to split a given array such that the difference between their maximums is minimized . ; Sort the array ; Return the difference between two highest elements ; Driver Program
def findMinDif ( arr , N ) : NEW_LINE INDENT arr . sort ( ) NEW_LINE return ( arr [ N - 1 ] - arr [ N - 2 ] ) NEW_LINE DEDENT arr = [ 7 , 9 , 5 , 10 ] NEW_LINE N = len ( arr ) NEW_LINE print ( findMinDif ( arr , N ) ) NEW_LINE