mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-12-19 07:00:35 +08:00
Format code with prettier (#3375)
This commit is contained in:
@@ -16,10 +16,13 @@ public class ThreeSumProblem {
|
||||
arr[i] = scan.nextInt();
|
||||
}
|
||||
ThreeSumProblem th = new ThreeSumProblem();
|
||||
System.out.println("Brute Force Approach\n" + (th.BruteForce(arr, ts)) + "\n");
|
||||
System.out.println("Two Pointer Approach\n" + (th.TwoPointer(arr, ts)) + "\n");
|
||||
System.out.println(
|
||||
"Brute Force Approach\n" + (th.BruteForce(arr, ts)) + "\n"
|
||||
);
|
||||
System.out.println(
|
||||
"Two Pointer Approach\n" + (th.TwoPointer(arr, ts)) + "\n"
|
||||
);
|
||||
System.out.println("Hashmap Approach\n" + (th.Hashmap(arr, ts)));
|
||||
|
||||
}
|
||||
|
||||
public List<List<Integer>> BruteForce(int[] nums, int target) {
|
||||
@@ -36,11 +39,11 @@ public class ThreeSumProblem {
|
||||
Collections.sort(temp);
|
||||
arr.add(temp);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
arr = new ArrayList<List<Integer>>(new LinkedHashSet<List<Integer>>(arr));
|
||||
arr =
|
||||
new ArrayList<List<Integer>>(new LinkedHashSet<List<Integer>>(arr));
|
||||
return arr;
|
||||
}
|
||||
|
||||
@@ -67,7 +70,6 @@ public class ThreeSumProblem {
|
||||
} else {
|
||||
end -= 1;
|
||||
}
|
||||
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@@ -98,5 +100,4 @@ public class ThreeSumProblem {
|
||||
}
|
||||
return new ArrayList(ts);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user