I am an absolute beginner in this time complexity thing as well. What I meant by extra memory was. When you do
nums.extend([0] * count)
[0]*count would result in [0, 0, 0]. And this list with [0, 0, 0] will have a different memory id then your nums list.
That try expect thing is really nice. I recently read about it in some blog as well. That this is a good way to do.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I am an absolute beginner in this time complexity thing as well. What I meant by extra memory was. When you do
[0]*count would result in [0, 0, 0]. And this list with [0, 0, 0] will have a different memory id then your nums list.
That try expect thing is really nice. I recently read about it in some blog as well. That this is a good way to do.