文件: root - text - article - 2020 - 02 - plus-one.txt
标签: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | 英文 | 主页 | 类别: 计算机科学 | 1116 次阅读, 19750 次搜索 | 90 个单词
| 浏览 | 博客存档
![定阅此目录的博客 定阅此目录的博客](/images/form/rss.gif)
标签: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | 英文 | 主页 | 类别: 计算机科学 | 1116 次阅读, 19750 次搜索 | 90 个单词
![定阅此目录的博客 定阅此目录的博客](/images/form/rss.gif)
Hi, here's your problem today. This problem was recently asked by LinkedIn:
Given a non-empty array where each element represents a digit of a non-negative integer, add one to the integer. The most significant digit is at the front of the array and each element in the array contains only one digit. Furthermore, the integer does not have leading zeros, except in the case of the number '0'.
Example:
Input: [2,3,4]
Output: [2,3,5]
标签: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | 英文 | 主页 | 类别: 计算机科学 | 1116 次阅读, 19750 次搜索 | 90 个单词 Given a non-empty array where each element represents a digit of a non-negative integer, add one to the integer. The most significant digit is at the front of the array and each element in the array contains only one digit. Furthermore, the integer does not have leading zeros, except in the case of the number '0'.
Example:
Input: [2,3,4]
Output: [2,3,5]
class Solution():
def plusOne(self, digits):
# Fill this in.
num = [2, 9, 9]
print(Solution().plusOne(num))
# [3, 0, 0]
![定阅此目录的博客 定阅此目录的博客](/images/form/rss.gif)
猜您喜欢...
- Delphi Dynamic Array
- Daily Interview Question: Edit Distance
- Algorithm Interview Question: Nth Fibonacci Number
- Daily Interview Problem: Room scheduling
- Invert a Binary Tree
- Algorithm Interview: No Adjacent Repeating Characters
- YES!!
- Patterns for breaking down questions you haven
- Daily Interview Problem: Jump to the End
- Daily Interview Problem: Circle of Chained Words
©2006~2024 牛排过熟 - 0.02023 秒 - 937.454 KB/s - 48 在线
内存: 492.92 KB
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - 服务器 PHP 版本号: 7.4.33
牛排怎么做才好吃? | <meta name="机器人" content="索引, 跟踪">
![](/images/top.jpg)
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - 服务器 PHP 版本号: 7.4.33
读写完全 - 一般 - 最小 - 表格 - 所有评论 - 统计
当前页暂时没有评论。