2 ms·
The solutions return a ^ b ? c : a return a == b ? a : c Are expressing exactly the same idea- When A and B are identical, they will xor to 0, and ot
by RodgerTheGreat 15y ago
The solutions
return a ^ b ? c : a
return a == b ? a : c
Are expressing exactly the same idea- When A and B are identical, they will xor to 0, and otherwise something nonzero. Thus, xor can be thought of in general as a "!=" operator, provided booleans work like you'd expect in C.
- sonic0002 15y agoThank you for your remind. We have corrected the error. Yes, you are right, these two solutions have the same logic.