首页
IT
登录
6mi
u
盘
搜
搜 索
IT
leetcode 371 Sum of Two Integers C++
leetcode 371 Sum of Two Integers C++
xiaoxiao
2025-08-02
6
利用到了与或的思想,算出每一次的进位,加到原来的数字上。
int getSum(int a, int b) { while(b){ int carry = a & b; a = a ^ b; b = carry << 1; } return a; }
转载请注明原文地址: https://ju.6miu.com/read-1301322.html
最新回复
(
0
)