3 ms·
The sum built-in is still using the addition operator with syntactic sugar though (as is the other child comment). I think the intent of this question is to so
by tedmiston 10y ago
The sum built-in is still using the addition operator with syntactic sugar though (as is the other child comment). I think the intent of this question is to solve it with bitwise operators ie, [1].
[1]: http://stackoverflow.com/questions/17342042/why-this-code-for-additionusing-bitwise-operation-works-in-java http://stackoverflow.com/questions/17342042/why-this-code-fo...
- jacquesm 10y agoIf you're going to have to argue about the 'intent of the question' then you've already lost. Really, the question should be 'add these two integers' and any solution that produces the result in a transparent and straightforward way should be honored with top marks. Trick questions, especially those where only the interviewers pet solution is permitted are a sure sign that this employer is best avoided because they care about form and ego more than they care about getting the bloody job done.