Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
find minimum in right sorted array
def find_min(A, n): l, r = 0, n-1 while l < r: m = (l+r) // 2 if A[l] > A[m]: if A[m] < A[m+1] and A[m] < A[m-1]: return A[m] r = m - 1 else: if A[m] < A[r]: return A[l] else: l = m + 1 return A[r] def main(): for _ in range(int(input())): n = int(input()) A = list(map(int, input().split())) print(find_min(A, n)) if __name__ == '__main__': main()
run
|
edit
|
history
|
help
0
ct
Python.py
gj2
Gauss
Sk
func1
Урок 4 задача 4: решить в целых числах уравнение ax=b (python)
pytest
LinkedList implementation
gj