demons_paw's blog

By demons_paw, history, 21 month(s) ago, In English

Given an array of size $$$n$$$. How can we find sum of XOR sum of all subsets in better than $$$O(2^n)$$$ ?
For example consider $$$array = [1,4,5]$$$
$$$ Answer = 1 + 4 + 5 + 1^4 + 1^5 + 4^5 + 1^4^5 $$$ (here '^' denotes bitwise XOR )

Basically harder version of this leetcode problem, with nums.length <= 10^5.

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it