当前位置:网站首页>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;
}
}

边栏推荐
- Calculation (computer) code of suffix expression
- 连通块模板及变式(共4题)
- 2022 safety officer-c certificate examination questions and mock examination
- how to add one row in the dataframe?
- Use the open source project [banner] to achieve the effect of rotating pictures (with dots)
- [staff] restore mark (Introduction to the use of restore mark | example analysis of Metaphone mark and restore mark)
- If you want to rewind the video picture, what simple methods can you use?
- es面試題
- WebGPU(一):基本概念
- Additional: information desensitization;
猜你喜欢

The wave of layoffs in big factories continues, but I, who was born in both non undergraduate schools, turned against the wind and entered Alibaba

Leetcode face T10 (1-9) array, ByteDance interview sharing

An analysis of circuit for quick understanding

【带你学c带你飞】4day第2章 用C语言编写程序(练习 2.5 生成乘方表与阶乘表

Leetcode question brushing (10) - sequential question brushing 46 to 50

AcWing 245. Can you answer these questions (line segment tree)

WebGPU(一):基本概念
![[road of system analyst] collection of wrong topics in enterprise informatization chapter](/img/c4/0bb4823ca85c440b4e0587a91b2585.jpg)
[road of system analyst] collection of wrong topics in enterprise informatization chapter

Comparative analysis of MVC, MVP and MVVM, source code analysis

Webgpu (I): basic concepts
随机推荐
CSDN insertion directory in 1 second
Vsocde has cli every time it is opened js
Questions d'entrevue
Software testing learning notes - network knowledge
Face++ realizes face detection in the way of flow
How to run oddish successfully from 0?
离婚3年以发现尚未分割的共同财产,还可以要么
how to come in an investnent bank team
Query word weight, search word weight calculation
Actual battle of financial risk control - under Feature Engineering
【liuyubobobo-玩转Leetcode算法面试】【00】课程概述
Pat a-1165 block reversing (25 points)
研发中台拆分过程的一些心得总结
Multi threaded query, double efficiency
The number one malware in January 2022: lokibot returned to the list, and emotet returned to the top
【无标题】
超图iServer rest服务之feature查询
QT使用sqllite
[staff] the direction of the symbol stem and the connecting line (the symbol stem faces | the symbol stem below the third line faces upward | the symbol stem above the third line faces downward | the
Sword finger offer 31 Stack push in and pop-up sequence