当前位置:网站首页>Addition without addition, subtraction, multiplication and division (simple difficulty)
Addition without addition, subtraction, multiplication and division (simple difficulty)
2022-07-02 02:38:00 【Nulibiao】
Title Overview ( Simple difficulty )

Topic link :
Point me into the leetcode
Ideas and code
Train of thought display
We still choose to look at the solution of this topic , I have carefully selected the following solutions , You can watch it directly :
This solution is the best one I think
The solution of this problem is also good
Now let's talk about binary addition
Click me to enter the blog One thing to note is that binary addition is full 2 Into the 1, Then full 2 The number subtracted from the digit of is 2, Not at all 1.
You can see my blog about shift operators :
Click me to enter the blog
You can also see the introduction of this topic :
Click to enter the solution
Code example
class Solution {
public int add(int a, int b) {
while(b != 0) {
int temp = a ^ b;
int cur = (a & b) << 1;
a = temp;
b = cur;
}
return a;
}
}

边栏推荐
- [JSON] gson use and step on the pit
- A quick understanding of analog electricity
- 附加:信息脱敏;
- Which brand of sports headset is better? Bluetooth headset suitable for sports
- A quick understanding of digital electricity
- Es interview questions
- STM32__05—PWM控制直流电机
- 实现一个自定义布局的扫码功能
- 2022 safety officer-c certificate examination questions and mock examination
- Face++ realizes face detection in the way of flow
猜你喜欢

【读书笔记】程序员修炼手册—实战式学习最有效(项目驱动)

Formatting logic of SAP ui5 currency amount display
![[learn C and fly] 3day Chapter 2 program in C language (exercise 2.3 calculate piecewise functions)](/img/8e/a86a9724251718d98ce172a6a96e53.png)
[learn C and fly] 3day Chapter 2 program in C language (exercise 2.3 calculate piecewise functions)

Query word weight, search word weight calculation

Opencascade7.6 compilation

How to turn off debug information in rtl8189fs

Sword finger offer 62 The last remaining number in the circle

软件开发生命周期 --瀑布模型
![[learn C and fly] 2day Chapter 8 pointer (practice 8.1 password unlocking)](/img/2e/8fe55393ccca6663d98c0b3dd9a146.png)
[learn C and fly] 2day Chapter 8 pointer (practice 8.1 password unlocking)

研发中台拆分过程的一些心得总结
随机推荐
[staff] pitch representation (bass clef | C1 36 note pitch representation | C2 48 note pitch representation | C3 60 note pitch representation)
A quick understanding of digital electricity
How to run oddish successfully from 0?
[staff] restore mark (Introduction to the use of restore mark | example analysis of Metaphone mark and restore mark)
Face++ realizes face detection in the way of flow
Jvm-01 (phased learning)
[deep learning] Infomap face clustering facecluster
es面試題
LFM信号加噪、时频分析、滤波
Sword finger offer 47 Maximum value of gifts
【带你学c带你飞】3day第2章 用C语言编写程序(练习 2.3 计算分段函数)
DNS domain name resolution
Is bone conduction earphone better than traditional earphones? The sound production principle of bone conduction earphones is popular science
Sword finger offer 29 Print matrix clockwise
2022 low voltage electrician test question simulation test question bank simulation test platform operation
How to batch add background and transition effects to videos?
实现一个自定义布局的扫码功能
批量检测url是否存在cdn—高准确率
Additional: information desensitization;
Jointly developed by nailing, the exclusive functions of glory tablet V7 series were officially launched