当前位置:网站首页>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;
}边栏推荐
- Leetcode - 460 LFU cache (Design - hash table + bidirectional linked hash table + balanced binary tree (TreeSet))*
- The 4G module designed by the charging pile obtains NTP time through mqtt based on 4G network
- Toolbutton property settings
- 使用密钥对的形式连接阿里云服务器
- 2312、卖木头块 | 面试官与狂徒张三的那些事(leetcode,附思维导图 + 全部解法)
- LeetCode - 919. 完全二叉树插入器 (数组)
- 03 fastjason solves circular references
- 20220604数学:x的平方根
- My openwrt learning notes (V): choice of openwrt development hardware platform - mt7688
- LeetCode - 715. Range 模块(TreeSet) *****
猜你喜欢

My notes on the development of intelligent charging pile (III): overview of the overall design of the system software

03 fastjason solves circular references

openEuler kernel 技術分享 - 第1期 - kdump 基本原理、使用及案例介紹

Openeuler kernel technology sharing - Issue 1 - kdump basic principle, use and case introduction

LeetCode 面试题 17.20. 连续中值(大顶堆+小顶堆)

Opencv gray histogram, histogram specification

Working mode of 80C51 Serial Port

2312. Selling wood blocks | things about the interviewer and crazy Zhang San (leetcode, with mind map + all solutions)

Swing transformer details-1

LeetCode - 895 最大频率栈(设计- 哈希表+优先队列 哈希表 + 栈) *
随机推荐
Cases of OpenCV image enhancement
Open Euler Kernel Technology Sharing - Issue 1 - kdump Basic Principles, use and Case Introduction
Installation and removal of MySQL under Windows
Leetcode - 933 number of recent requests
LeetCode - 5 最长回文子串
Working mode of 80C51 Serial Port
QT detection card reader analog keyboard input
My 4G smart charging pile gateway design and development related articles
Qcombox style settings
Google browser plug-in recommendation
Tensorflow2.0 save model
Adaptiveavgpool1d internal implementation
20220602数学:Excel表列序号
Octave instructions
Yocto Technology Sharing Phase 4: Custom add package support
LeetCode - 1670 設計前中後隊列(設計 - 兩個雙端隊列)
CV learning notes convolutional neural network
(2)接口中新增的方法
Of course, the most widely used 8-bit single chip microcomputer is also the single chip microcomputer that beginners are most easy to learn
Leetcode - 1670 conception de la file d'attente avant, moyenne et arrière (conception - deux files d'attente à double extrémité)