mirror of
https://git.wolves.top/wolves/leetcode.git
synced 2025-11-04 17:26:32 +08:00
14 lines
279 B
C++
14 lines
279 B
C++
//
|
|
// Created by 李洋 on 2023/8/19.
|
|
//
|
|
class Q2235 {
|
|
public:
|
|
int sum(int num1, int num2) {
|
|
while (num2) {
|
|
unsigned int carry = (unsigned int) (num1 & num2) << 1;
|
|
num1 ^= num2;
|
|
num2 = carry;
|
|
}
|
|
return num1;
|
|
}
|
|
}; |