当前位置:网站首页>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;
}
边栏推荐
- Serial communication based on 51 single chip microcomputer
- Leetcode-112:路径总和
- 4G module initialization of charge point design
- When the reference is assigned to auto
- LeetCode 面试题 17.20. 连续中值(大顶堆+小顶堆)
- ADS simulation design of class AB RF power amplifier
- 2021-10-28
- CV learning notes - camera model (Euclidean transformation and affine transformation)
- 20220602数学:Excel表列序号
- [combinatorics] Introduction to Combinatorics (combinatorial idea 3: upper and lower bound approximation | upper and lower bound approximation example Remsey number)
猜你喜欢
Opencv histogram equalization
Octave instructions
LeetCode - 715. Range 模块(TreeSet) *****
The new series of MCU also continues the two advantages of STM32 product family: low voltage and energy saving
Cases of OpenCV image enhancement
Leetcode 300 longest ascending subsequence
CV learning notes - feature extraction
CV learning notes - reasoning and training
Opencv notes 20 PCA
Development of intelligent charging pile (I): overview of the overall design of the system
随机推荐
Swing transformer details-2
For new students, if you have no contact with single-chip microcomputer, it is recommended to get started with 51 single-chip microcomputer
LeetCode - 933 最近的请求次数
Leetcode - 895 maximum frequency stack (Design - hash table + priority queue hash table + stack)*
CV learning notes - edge extraction
2312、卖木头块 | 面试官与狂徒张三的那些事(leetcode,附思维导图 + 全部解法)
My notes on the development of intelligent charging pile (III): overview of the overall design of the system software
3.2 Off-Policy Monte Carlo Methods & case study: Blackjack of off-Policy Evaluation
[combinatorics] Introduction to Combinatorics (combinatorial idea 3: upper and lower bound approximation | upper and lower bound approximation example Remsey number)
CV learning notes - Stereo Vision (point cloud model, spin image, 3D reconstruction)
When the reference is assigned to auto
Positive and negative sample division and architecture understanding in image classification and target detection
Wireshark use
STM32 running lantern experiment - library function version
Leetcode-106:根据中后序遍历序列构造二叉树
I think all friends should know that the basic law of learning is: from easy to difficult
20220531数学:快乐数
openEuler kernel 技術分享 - 第1期 - kdump 基本原理、使用及案例介紹
Of course, the most widely used 8-bit single chip microcomputer is also the single chip microcomputer that beginners are most easy to learn
Drive and control program of Dianchuan charging board for charging pile design