3 ms·
Interesting you should say that. What about having both the sum and the xor? Then it's two equations, two unknowns. That should be enough to solve for it...
by mikepurvis 16y ago
Interesting you should say that. What about having both the sum and the xor? Then it's two equations, two unknowns. That should be enough to solve for it...
- esrauch 16y agoI actually posted a reply to this above, knowing both the sum and the xor is not sufficient to determine the two variables. Consider a situation where you know that (a xor b) = 1 and (a - b) = 1. Both a missing 2/extra 3 and missing 4/extra5 and any 2^N/2^N+1 are solutions to that equation. Just because you have two equations and two unknowns doesn't necessarily mean you end up with a single value for each except in certain circumstances (eg they are linear equations of full rank).