mirror of
https://github.com/lWolvesl/leetcode.git
synced 2026-01-13 02:38:37 +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;
|
|
}
|
|
}; |