educative.io

Educative

Help with understanding example 2 quiz

Should the answer not be 5n^2+3n+3…since you have to count the print() statement at the end.

Your answer is “If we make this change, sum = 0 is run n times, whereas before it was running once. So, there’s an increase of n - 1 invocations for that line.”

Please explain, thanks.

Hi @Chris_Ilozulu ,

You are right about the time complexity. We’ve made an update to the lesson accordingly. Thank you for pointing it out. Feel free to drop any more questions/comments.

– Team Educative

Hi this answer has not been updated. What is the correct answer, I’m confused about this?