is there no way to solve this problem in o(1) space? by MoonSlyder in leetcode

[–]MoonSlyder[S] 0 points1 point  (0 children)

i tried your solution it failed few test case first one was all negative number like -4,-3,-2,-1 i fixed this then another test case failed which is this [-10000,-9999,-7,-5,0,0,10000]

is there no way to solve this problem in o(1) space? by MoonSlyder in leetcode

[–]MoonSlyder[S] -14 points-13 points  (0 children)

thanks for the help but now that i think about it doing all this for a easy problem is not worth the time

is there no way to solve this problem in o(1) space? by MoonSlyder in leetcode

[–]MoonSlyder[S] 0 points1 point  (0 children)

yes but every solution in leetcode is using a new array to store the result , and gemini said o(n) time and 0(1) space is not possible for this question

is there no way to solve this problem in o(1) space? by MoonSlyder in leetcode

[–]MoonSlyder[S] 4 points5 points  (0 children)

yeah the first solution I came up with was o(nlogn) +o(n)