✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.
What is the worst-case time complexity of this function?
Make sure you define any variables you use and you can ignore the cost of comparison. (no explanation, no marks)
def func(arr: List[int], target: int) -> List[int]:
n = len(arr)
for i in range(n - 1):
for j in range(i + 1, n):
if arr[i] + arr[j] == target:
return [i, j]
return []
Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!