文件: root - text - article - 2020 - 02 - plus-one.txt
标签: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | 英文 | 主页 | 类别: 计算机科学 | 1415 次阅读, 22910 次搜索 | 90 个单词
| 浏览 | 博客存档
标签: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | 英文 | 主页 | 类别: 计算机科学 | 1415 次阅读, 22910 次搜索 | 90 个单词
| 浏览 | 博客存档
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, | 英文 | 主页 | 类别: 计算机科学 | 1415 次阅读, 22910 次搜索 | 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]
猜您喜欢...
- Find the non-duplicate number
- Daily Interview Problem: Circle of Chained Words
- Daily Interview Puzzle: Intersection of Linked Lists
- YES!!
- Daily Interview Problem: Deepest Node in a Binary Tree
- [Daily Problem] Angles of a Clock
- Kaprekar
- Sort a Partially Sorted List
- Daily Interview Problem: Merge List Of Number Into Ranges
- Daily Interview Question: Word Search
©2006~2024 牛排过熟 - 0.00739 秒 - 2636.891 KB/s - 22 在线 内存: 491.36 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="不索引, 跟踪" />
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - 服务器 PHP 版本号: 7.4.33
评论 (0)
读写完全 - 一般 - 最小 - 表格 - 所有评论 - 统计
当前页暂时没有评论。