@StudY/.algorithm

[Day12] 15. 3Sum

킬로그램y 2019. 3. 6. 11:17

Given an array nums of n integers, are there elements abc in nums such that a + b + c= 0? Find all unique triplets in the array which gives the sum of zero.

Note:

The solution set must not contain duplicate triplets.

Example:

Given array nums = [-1, 0, 1, 2, -1, -4],

A solution set is:
[
  [-1, 0, 1],
  [-1, -1, 2]
]


어... 상당히 어려운 문제다.....

어떻게 접근을 해야하지???? 최적의 Big-O 시간 복잡가 과연 뭘까????