Skip to content

Latest commit

 

History

History
7 lines (6 loc) · 250 Bytes

nsum.md

File metadata and controls

7 lines (6 loc) · 250 Bytes

Template

NSum problem is most likely solved by:

  1. sort the array
  2. Iterate the outer (L-2) layers
  3. two-pointers search in the inner most 2 layers.

So the time complexity is: O(L^(N-1)), L is length of array, N is number of elements to NSum.