MCPcopy Create free account
hub / github.com/camilamaia/jornada-big-tech / threeSum

Method threeSum

leetcode/src/ThreeSum.java:3–16  ·  view source on GitHub ↗
(int[] nums)

Source from the content-addressed store, hash-verified

1/** Problem: https://leetcode.com/explore/interview/card/google/59/array-and-strings/3049/ */
2class Solution {
3 public List<List<Integer>> threeSum(int[] nums) {
4 List<List<Integer>> results = new ArrayList<>();
5
6 Arrays.sort(nums);
7
8 for (int i = 0; i < nums.length; i++) {
9 if (i != 0 && nums[i] == nums[i - 1]) {
10 continue;
11 }
12 twoSum(i, nums, results);
13 }
14
15 return results;
16 }
17
18 private void twoSum(int i, int[] nums, List<List<Integer>> results) {
19 int leftPointer = i + 1;

Callers

nothing calls this directly

Calls 1

twoSumMethod · 0.95

Tested by

no test coverage detected