Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.

Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).

4Sum II

Y

Why is the space complexity O(N^2)? Since you only used a HashMap(O(N)) and a constant space int(O(1)) , shouldn't it be O(N)? Thanks for answering.

L

Wow beautiful

J

Easy to understand. Thanks!

M

nice solution, incredible!

S

Thanks, easy to understand.

A

@pernekhan We can calculate sums counter for (n+1)/2 arrays. For the rest of arrays we can run through all elements for (x = n - (n+1)/2; m^x; m is length of array. and check by using the above technique

K

Time Limit Exceeded

No one has replied

T

@EileenVon thx

C

@DreamSeason To be honest, I was also surprised my method can get AC..... I don't know why sort would make difference....sorry.

Come on, write that in proper Python :-) Would be much nicer and only take two lines.

Disabled Categories are greyed out

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.