题目:
解析:
代码:
private int ret;//返回周结果private int path;//枚举一个元素就异或进去public int subsetXORSum(int[] nums) {dfs(nums, 0);return ret;} private void dfs(int[] nums, int pos){ret += path;for(int i = pos; i < nums.length; i++){path ^= nums[i];dfs(nums,i+1);//相同为0消除掉相同元素达到回复现场效果path ^= nums[i];}}