Function to implement binary search
def maximumDistance ( arr , n , m ) : NEW_LINE INDENT low = 1 NEW_LINE high = n - 1 NEW_LINE ans = 0 NEW_LINE while ( low <= high ) : NEW_LINE INDENT mid = ( low + high ) // 2 NEW_LINE DEDENT DEDENT