public void dfs(List<List<Integer>> res, List<Integer> candidates, int begin) {
        if (begin >= candidates.size() - 1) {
            res.add(new ArrayList<Integer>(candidates));
            return;
        }
        HashSet<Integer> hashSet = new HashSet<Integer>();
        for (int i = begin; i < candidates.size(); ++i) {
            int val = candidates.get(i);
            if(hashSet.contains(val))
                continue;
            hashSet.add(val);
            swap(candidates, i, begin);
            dfs(res, candidates, begin + 1);
            swap(candidates, i, begin);
        }
    }