LeetCode 371. Sum of Two Integers

来源:互联网 发布:2017年6月房地产数据 编辑:程序博客网 时间:2024/06/15 08:54
public class Solution {    public int getSum(int a, int b) {        int c = (a & b) << 1;int d = a ^ b;        while (c != 0) {        int tmp = d;        d = d ^ c;        c = (c & tmp) << 1;        }        return d;    }}

0 0
原创粉丝点击