Check for valid distance i . e mid
flag = check ( arr , n , m , mid ) NEW_LINE if ( flag ) : NEW_LINE INDENT ans = mid NEW_LINE low = mid + 1 NEW_LINE DEDENT else : NEW_LINE INDENT high = mid - 1 NEW_LINE DEDENT return ans NEW_LINE