public ArrayList<ArrayList<Integer>> permute(final int[] nums) {
        final ArrayList<ArrayList<Integer>> res = new ArrayList<ArrayList<Integer>>();
        if (nums == null || nums.length == 0) {
            return res;
        }

        helper(nums, new boolean[nums.length], new ArrayList<Integer>(), res);

        return res;
    }