
class Solution {
    //题解思路
    //
    LinkedList<Integer> path = new LinkedList<>(); 
    List<List<Integer>> results = new ArrayList<>();
    public List<List<Integer>> subsets(int[] nums) {
        //主方法中调用方法同时传入指定的参数初始值
        backTrack(nums, 0);
        return results;
    }
    public void backTrack(int[] nums, int startIndex) {
        results.add(new ArrayList<>(path));
        if (startIndex >= nums.length) {
            return;
        }
        for (int i = startIndex; i < nums.length; i++) {
            path.add(nums[i]);
            backTrack(nums, i +1);
            path.removeLast();
        }
        
    }
}



















