✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.
How many times will the marked line in the following code run when the size of the input list is n elements?Note: Just consider the dominant term.
def mystery(n):
res = 0
if n == 0:
return res
else:
i=0
while i < n:
for j in range(n):
res += j # This line
i+=1
return res
Answer in terms of n