Search
⌘K

Leetcode 1863. Sum of All Subset XOR Totals

Compute the sum of bitwise XORs of every subset of nums; observe each bit that appears in any element contributes independently and shows up in exactly half of the 2^n subsets, so the answer equals 2^(n-1) times the bitwise OR of all numbers.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.