当前位置:网站首页>Leetcode+ 66 - 70 high precision, two sub topics
Leetcode+ 66 - 70 high precision, two sub topics
2022-06-28 07:02:00 【Sauerkraut】
Add one
Algorithm tags : Array 、 mathematics

Give us an integer , This integer is represented by an array , Add... To this integer 1, Add 1 After that, we use array to represent , The highest bit of the array is placed at 0 A place , Put the second highest order to the 1 A place , Suppose this array has no leading 0, In fact, it gives a very long integer , Simulate the process of addition

Because the highest bit may carry , So you need to flip the array first , Keep your position at the 0 A place , Ten in the first place 1 A place , Start with a bit , Calculate the value of the current bit each time , See if there is a carry , If there is a carry, carry one
How to calculate the number in the current position each time ?
A bit should be the number in the original position plus 1, Plus the carry , add 1 It can be seen as a step forward , Each digit can be regarded as the original digit plus the carry , The carry can be 0 It can also be 1, After adding , The number of current positions is the sum of this number divided by 10 The remainder of , The carry is the sum and division of this number
边栏推荐
- A small code editor can also run programs -- a summary of sublime Text3 running programs in various languages
- Singleton singleton mode
- [rust daily] published on rust 1.43.0 on April 23, 2020
- What if the applet page is set to 100% height or left blank?
- 剑指offer II 091.粉刷房子
- ice - 资源
- 代码没写错,渲染页面不显示原因
- MySQL installation steps - Linux configuration file JDK installation (II)
- 实时数据库 - 笔记
- [produced by Xinghai] operation and maintenance inspection collection
猜你喜欢

Design and practice of vivo sensitive word matching system

语音增强-频谱映射

代码没写错,渲染页面不显示原因

SQL statement optimization steps (1)

Jinshan cloud team shared | 5000 words to understand how Presto matches with alluxio

Tryout title code

FPGA - 7 Series FPGA selectio -07- iserdese2 of advanced logic resources

选拔赛题目代码

浮动与定位

FPGA - 7 Series FPGA selectio -09- io of advanced logic resources_ FIFO
随机推荐
未来互联网人才还稀缺吗?哪些技术方向热门?
【网络教程】IPtables官方教程--学习笔记1
RN7302三相电量检测(基于STM32单片机)
编译原理期末复习
【C语言】详解 C 语言获取数组长度
实时数据库 - 笔记
Call interface event API common event methods
What is a consistent hash? What scenarios can it be applied to?
Pytorch RNN learning notes
An important term in MySQL -- CRUD
VM332 WAService. js:2 Error: _ vm. Changetabs is not a function
FPGA - 7 Series FPGA selectio -09- io of advanced logic resources_ FIFO
最后的二十九天
代码没写错,渲染页面不显示原因
全方位透析真实企业软件测试流程
[digital statistics DP] counting problem
Will Internet talents be scarce in the future? Which technology directions are popular?
freeswitch设置最大呼叫时长
A small code editor can also run programs -- a summary of sublime Text3 running programs in various languages
Jinshan cloud team shared | 5000 words to understand how Presto matches with alluxio