A+B=>A,没有考虑溢出的可能性,所以是有bug的。
所有跟帖:
• 假设是unsigned。如果有a+b有overflow -g9- ♀ (137 bytes) () 12/21/2013 postreply 19:57:55
• u can get negative number. Same for + and - -inet-fan- ♂ (0 bytes) () 12/21/2013 postreply 20:59:34
• How would you get a negative number? -g9- ♀ (0 bytes) () 12/21/2013 postreply 21:03:33
• A=A XOR B, B= A XOR B, A = A XOR B, done -inet-fan- ♂ (0 bytes) () 12/21/2013 postreply 20:43:06
• 不错。是自己搞出来的? -g9- ♀ (0 bytes) () 12/21/2013 postreply 21:14:29
• Come-on. That is an appetizer in interview -inet-fan- ♂ (140 bytes) () 12/22/2013 postreply 16:40:21
• 老大,🐂 -wxcmvyanyan- ♀ (0 bytes) () 12/21/2013 postreply 21:36:32
• 🐂是个啥东东? -inet-fan- ♂ (0 bytes) () 12/22/2013 postreply 16:46:33