Beats me! Just post solution of other guy.
Problem
Java
two pointers
© LeetCode – 3Sum - two pointers
1 | class Solution { |
Submission Detail
- 318 / 318 test cases passed.
- Runtime: 21 ms, faster than 65.13% of Java online submissions for 3Sum.
- Memory Usage: 43.1 MB, less than 88.54% of Java online submissions for 3Sum.
Quadratic algorithm
1 | class Solution { |
Submission Detail
- 318 / 318 test cases passed.
- Runtime: 230 ms, faster than 27.64% of Java online submissions for 3Sum.
- Memory Usage: 43.5 MB, less than 64.19% of Java online submissions for 3Sum.
concise solution
© Java clean solution (15 lines) https://leetcode.com/problems/3sum/discuss/865345/Java-clean-solution-(15-lines)
1 | class Solution { |
Submission Detail
- 318 / 318 test cases passed.
- Runtime: 768 ms, faster than 6.51% of Java online submissions for 3Sum.
- Memory Usage: 43.4 MB, less than 73.80% of Java online submissions for 3Sum.