You are viewing a single comment's thread. Return to all comments →
The problem says that we have a number n. The possible generated numbers from n are 0 to 2^N - 1. Lets say this value is x.
power set of x will generate 2 ^ x sets.
xor is a modulo 2 sum i.e. sum all the elements and take its xor. if the sum is even then it will generate 0 otherwise 1.
from the 2^x sets, half will generate even sum and half will generate odd.
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Number of zero-xor subsets
You are viewing a single comment's thread. Return to all comments →
The problem says that we have a number n. The possible generated numbers from n are 0 to 2^N - 1. Lets say this value is x.
power set of x will generate 2 ^ x sets.
xor is a modulo 2 sum i.e. sum all the elements and take its xor. if the sum is even then it will generate 0 otherwise 1.
from the 2^x sets, half will generate even sum and half will generate odd.