leetcode -- Plus One--与add binary类似--要了解
来源:互联网 发布:标致pp2000软件下载 编辑:程序博客网 时间:2024/05/29 08:17
https://leetcode.com/problems/plus-one/
class Solution(object): def plusOne(self, digits): """ :type digits: List[int] :rtype: List[int] """ reg = 0 res = [] for i in xrange(len(digits) - 1, -1, -1): if i == len(digits) - 1: tmp = int(digits[i]) + 1 + reg else: tmp = int(digits[i]) + reg mod = tmp % 10 inc = tmp / 10 reg = inc res.append(mod) if reg != 0: res.append(1) return res[::-1]
0 0
- leetcode -- Plus One--与add binary类似--要了解
- LeetCode 67. Add Binary/ 66. Plus One
- Leetcode 67. Add Binary 66. Plus One
- Leetcode#66. Plus One &&Add Binary (大数)
- [LeetCode] Add Two Numbers、Divide Two Integers、Multiply Strings、Add Binary、Plus One
- LeetCode 2.Add Two Numbers,67.Add Binary,371.Sum of Two Integers,66.Plus One
- leetcode -- Add Binary -- 简单要了解
- 数字加和问题: plus one , Add Binary, Add Two Numbers
- LeetCode: Plus One
- LeetCode Plus One
- [Leetcode] Plus One
- LeetCode: Plus One
- leetcode 33: Plus One
- [LeetCode] Plus One
- [leetCode] Plus One
- 【leetcode】Plus One
- [LeetCode]Plus One
- [leetcode]Plus One
- 分布式数据重复提交
- python: error while loading shared libraries: libpython3.4m.so.1.0: cannot open shared object file:
- Linux -----oops错误
- ubuntu14.04密码正确,进入不了图形界面
- 【Unity开发】简单的对象池实现
- leetcode -- Plus One--与add binary类似--要了解
- (一)使用RED5搭建流媒体服务器
- mybatis实战教程之开发环境搭建、以接口的方式编程、实现数据的增删改查
- 推荐系统导论笔记(六)
- leetcode之Burst Balloons
- python 中 类, 模块, 包的组织
- 实时监听textField的值改变事件
- uva 1077 - The Sky is the Limit(离散化)
- 高精度加法