Format code with prettier (#3375)

This commit is contained in:
acbin
2022-10-03 17:23:00 +08:00
committed by GitHub
parent 32b9b11ed5
commit e96f567bfc
464 changed files with 11483 additions and 6189 deletions

View File

@ -7,7 +7,9 @@ import java.util.*;
* @author Alan Piao (https://github.com/cpiao3)
*/
public class Combination {
private static int length;
/**
* Find all combinations of given array using backtracking
* @param arr the array.
@ -26,6 +28,7 @@ public class Combination {
backtracking(array, 0, new TreeSet<T>(), result);
return result;
}
/**
* Backtrack all possible combinations of a given array
* @param arr the array.
@ -34,7 +37,12 @@ public class Combination {
* @param result the list contains all combination.
* @param <T> the type of elements in the array.
*/
private static <T> void backtracking(T[] arr, int index, TreeSet<T> currSet, List<TreeSet<T>> result) {
private static <T> void backtracking(
T[] arr,
int index,
TreeSet<T> currSet,
List<TreeSet<T>> result
) {
if (index + length - currSet.size() > arr.length) return;
if (length - 1 == currSet.size()) {
for (int i = index; i < arr.length; i++) {