n = 5 # n can be anything sum = 0 for i in range(n): for j in range(n): sum += 1 print(sum)
We’re told the time complexity of this code is 5n2+2n+4. Then we add
sum = 0 to the outer loop. This adds
n operations. So the solution should be 5n2+3n+4, not 5n2+4n+4.