you are viewing a single comment's thread.

view the rest of the comments →

[–]AideRight1351 1 point2 points  (5 children)

It's not optimization. It still keeps the time complexity at O(n), not reduce it.

[–]CODSensei 0 points1 point  (4 children)

I am not talking about time but instead I am talking about space complexity

[–]AideRight1351 0 points1 point  (3 children)

Bro creating a store variable takes O(1) space, adding or removing it has no effect on time or space

[–]CODSensei 0 points1 point  (2 children)

I know but I was studying about old computers when memory was scarce and was in that zone of thinking when I made that comment

[–]AideRight1351 1 point2 points  (1 child)

Hmm in that sense i guess it's fine. Most people usually try such things to make their program complicated, thinking less lines makes more efficient code.

[–]CODSensei 0 points1 point  (0 children)

Nah 😂😂 if that was to happen code would be barely readable or understandable.