当前位置:网站首页>20220607其他:两整数之和
20220607其他:两整数之和
2022-07-03 09:20:00 【丿SeeYouAgain】
题目描述:给你两个整数 a 和 b ,不使用 运算符 + 和 - ,计算并返回两整数之和。
编码实现:
public static int getSum(int a, int b) {
int bit = (a & b) << 1;
int result = a ^ b;
if (bit != 0){
return getSum(result,bit);
}
return result;
}边栏推荐
- STM32 running lantern experiment - library function version
- MySQL root user needs sudo login
- Replace the files under the folder with sed
- 使用sed替换文件夹下文件
- CV learning notes - feature extraction
- After clicking the Save button, you can only click it once
- LeetCode - 1172 餐盘栈 (设计 - List + 小顶堆 + 栈))
- Interruption system of 51 single chip microcomputer
- Liquid crystal display
- Of course, the most widely used 8-bit single chip microcomputer is also the single chip microcomputer that beginners are most easy to learn
猜你喜欢

Serial communication based on 51 single chip microcomputer

2.1 Dynamic programming and case study: Jack‘s car rental

yocto 技術分享第四期:自定義增加軟件包支持

There is no shortcut to learning and development, and there is almost no situation that you can learn faster by leading the way

Working mode of 80C51 Serial Port

Connect Alibaba cloud servers in the form of key pairs

LeetCode - 508. Sum of subtree elements with the most occurrences (traversal of binary tree)

2312、卖木头块 | 面试官与狂徒张三的那些事(leetcode,附思维导图 + 全部解法)

Swing transformer details-1

使用密钥对的形式连接阿里云服务器
随机推荐
Opencv feature extraction - hog
Leetcode-100:相同的树
Simulate mouse click
LeetCode - 715. Range 模块(TreeSet) *****
Design of charging pile mqtt transplantation based on 4G EC20 module
20220609其他:多数元素
Yocto Technology Sharing Phase 4: Custom add package support
ADS simulation design of class AB RF power amplifier
Swing transformer details-2
LeetCode - 508. Sum of subtree elements with the most occurrences (traversal of binary tree)
CV learning notes - edge extraction
2021-11-11 standard thread library
Opencv note 21 frequency domain filtering
使用sed替换文件夹下文件
. DLL and Differences between lib files
LeetCode - 919. 完全二叉树插入器 (数组)
QT setting suspension button
JS foundation - prototype prototype chain and macro task / micro task / event mechanism
getopt_ Typical use of long function
51 MCU tmod and timer configuration