371. Sum of Two Integers
来源:互联网 发布:淘宝卖话费怎么没利润 编辑:程序博客网 时间:2024/05/21 20:55
原题链接: https://leetcode.com/problems/sum-of-two-integers/
Calculate the sum of two integers a and b, but you are not allowed to use the operator +
and -
.
Example:
Given a = 1 and b = 2, return 3.
public class Solution { public int getSum(int a, int b) { while(a>0){ int x = a ^ b; a = (a & b) << 1; b = x; } return b; }}
转载自:http://blog.csdn.net/qq508618087/article/details/51789576
0 0
- 371. Sum of Two Integers
- 371. Sum of Two Integers
- 371. Sum of Two Integers
- 371. Sum of Two Integers
- 371. Sum of Two Integers
- 371. Sum of Two Integers
- 371. Sum of Two Integers
- 371. Sum of Two Integers
- 371. Sum of Two Integers
- 371. Sum of Two Integers
- 371. Sum of Two Integers
- 371. Sum of Two Integers
- 371. Sum of Two Integers
- 371. Sum of Two Integers
- 371. Sum of Two Integers
- 371. Sum of Two Integers
- 371. Sum of Two Integers
- 371. Sum of Two Integers
- 【记录】独立看门狗
- maya中实时置换效果 dx11shader
- 使用C#(Random)随机数来制作随机字母数字混合密码生成器
- Cisco InterCloud
- YAML 语言教程
- 371. Sum of Two Integers
- java内部类总结
- 三维重建(二)Sift特征提取与匹配
- Codeforces Round #360 (Div. 1)A - NP-Hard Problem
- Android之SD卡简单的文件读写操作
- leetcode:Water and Jug Problem
- 2016sdau课程练习专题三 1008
- XMPP 学习笔记一 OpenFire与Spark安装
- PCH文件自定义NSLog及存在C文件时PCH文件定义注意事项