当前位置:网站首页>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;
}
}
边栏推荐
- If you want to rewind the video picture, what simple methods can you use?
- How to batch add background and transition effects to videos?
- Pytest testing framework
- Leetcode question brushing (10) - sequential question brushing 46 to 50
- Leetcode face T10 (1-9) array, ByteDance interview sharing
- Which brand of sports headset is better? Bluetooth headset suitable for sports
- query词权重, 搜索词权重计算
- Use the open source project [banner] to achieve the effect of rotating pictures (with dots)
- Jointly developed by nailing, the exclusive functions of glory tablet V7 series were officially launched
- C write TXT file
猜你喜欢
【带你学c带你飞】2day 第8章 指针(练习8.1 密码开锁)
Après le mariage
Webgpu (I): basic concepts
STM32__05—PWM控制直流电机
CoordinatorLayout + TabLayout + ViewPager2(里面再嵌套一个RecyclerView),RecyclerView的滑动冲突解决
What kind of good and cost-effective Bluetooth sports headset to buy
[staff] diacritical mark (ascending sign | descending sign B | double ascending sign x | double descending sign BB)
[learn C and fly] 4day Chapter 2 program in C language (exercise 2.5 generate power table and factorial table
[staff] restore mark (Introduction to the use of restore mark | example analysis of Metaphone mark and restore mark)
The basic steps of using information theory to deal with scientific problems are
随机推荐
Which brand of running headphones is good? How many professional running headphones are recommended
Jvm-01 (phased learning)
多线程查询,效率翻倍
2022 low voltage electrician test question simulation test question bank simulation test platform operation
Batch detect whether there is CDN in URL - high accuracy
pytest 测试框架
[learn C and fly] 2day Chapter 8 pointer (practice 8.1 password unlocking)
Coordinatorlayout + tablayout + viewpager2 (there is another recyclerview nested inside), and the sliding conflict of recyclerview is solved
WebGPU(一):基本概念
Ar Augmented Reality applicable scenarios
【带你学c带你飞】day 5 第2章 用C语言编写程序(习题2)
研发中台拆分过程的一些心得总结
【带你学c带你飞】1day 第2章 (练习2.2 求华氏温度 100°F 对应的摄氏温度
Deployment practice and problem solving of dash application development environment based on jupyter Lab
Questions d'entrevue
Sword finger offer 31 Stack push in and pop-up sequence
[question 008: what is UV in unity?]
AcWing 245. Can you answer these questions (line segment tree)
Query word weight, search word weight calculation
Software testing learning notes - network knowledge