博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
sum-of-two-integers
阅读量:6919 次
发布时间:2019-06-27

本文共 421 字,大约阅读时间需要 1 分钟。

// refer to// https://leetcode.com/discuss/111582/java-simple-easy-understand-solution-with-explanationclass Solution {public:    int getSum(int a, int b) {        //int tmp_sum = a ^ b; // a xor b        //int tmp_carry = a & b << 1; // (a & b) << 1                while (b != 0) {            int tmp_carry = a & b;            a = a ^ b; // a xor b            b = tmp_carry << 1;        }                return a;    }};

 

转载地址:http://xehcl.baihongyu.com/

你可能感兴趣的文章
走出IT管理员与IT工程师的误区
查看>>
Android及iOS版谷歌地图推出相关广告功能
查看>>
GitHub使用简介: github如何使用
查看>>
Spark1.2.1集群环境搭建——Standalone模式
查看>>
ospf的基础与邻居,邻接关系 --理论
查看>>
我的友情链接
查看>>
python linux 下安装 pip 和 bs4
查看>>
漏洞扫描及MBSA的使用
查看>>
shell 求交集
查看>>
find和tar命令的使用
查看>>
docker-compose 常用命令参数解释
查看>>
kali手动休眠
查看>>
回归分析模型优劣判断
查看>>
OpenMP编程->数据传递
查看>>
Oracle PL/SQL之嵌套表(Nested Table)
查看>>
Ext.grid.GridPanel不需按住Ctrl键单元行多选效果实现
查看>>
gradle运行java main
查看>>
highmaps绘制用户分布地图
查看>>
K2K 亚太原创品牌崛起的故事,释放个性,诠释崭新生活态度
查看>>
jquery获取tr下标
查看>>