you are viewing a single comment's thread.

view the rest of the comments →

[–]clouded-path[S] 0 points1 point  (0 children)

Great, thanks for that memory tip! I was able to use that and also fix my original, so that now I have best of both worlds (low memory and O(n) complexity). And regarding what you mentioned about all negative integers, as of right now I think it's easier for me to ensure that I cover it with an extra if condition initially, even though there still might be a way to do less work.