We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
ex : 10010
if we add two numbers there should be no carry generated then the xor of two numbers and sum is equal.
Inshort we need to find all numbers that sum to binary numbers and do not generate any carry .so for every bits with 0 there is 2 posiibility to add numbers let say we can add 100 and 001 or 1000 and 1100 . we need to find all ways.
one simple way is to multiply the no of current possible ways *2 to get the next possible outcome.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sum vs XOR
You are viewing a single comment's thread. Return to all comments →
ex : 10010 if we add two numbers there should be no carry generated then the xor of two numbers and sum is equal.
Inshort we need to find all numbers that sum to binary numbers and do not generate any carry .so for every bits with 0 there is 2 posiibility to add numbers let say we can add 100 and 001 or 1000 and 1100 . we need to find all ways. one simple way is to multiply the no of current possible ways *2 to get the next possible outcome.