✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
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