{leetcode}/problems/3sum/[LeetCode - 3Sum^]
Given an array nums
of n integers, are there elements a, b, c 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] ]
为什么参考资料中,JS 的代码可以通过,但是转成 Java 之后就不能通过呢?
- 一刷
-
link:{sourcedir}/_0015_3Sum.java[role=include]
- 二刷
-
link:{sourcedir}/_0015_3Sum_20.java[role=include]
- 二刷(万能方法)
-
link:{sourcedir}/_0015_3Sum_21.java[role=include]