private void helperUnique(int[] nums, boolean[] visited, List<Integer> path, List<List<Integer>> res) {
        if (path.size() == nums.length) {
            res.add(new ArrayList<>(path));
            return;
        }
        for (int i = 0; i < nums.length; i++) {
            if (i > 0 && visited[i - 1] && nums[i] == nums[i - 1])
                continue;
            if (!visited[i]) {
                visited[i] = true;
                path.add(nums[i]);
                helperUnique(nums, visited, path, res);
                path.remove(path.size() - 1);
                visited[i] = false;
            }
        }
    }