To the Top
File:  root - text - article - 2020 - 02 - plus-one.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 1055 Views, 18445 Search Bots | 90 Words

Subscribe to Feed Burner | Browse | Archive
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]

class Solution():
def plusOne(self, digits):
# Fill this in.

num = [2, 9, 9]
print(Solution().plusOne(num))
# [3, 0, 0]
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Cateogry: Computing | 1055 Views, 18445 Search Bots | 90 Words Subscribe to Feed Burner

Related Articles

  1. Daily Interview Puzzle: Ways to Traverse a Grid
  2. Binary Tree Level with Minimum Sum
  3. Algorithm Interview: Subarray With Target Sum
  4. Daily Interview Problem: Longest Substring With K Distinct Characters
  5. Daily Interview Problem: Full Binary Tree
  6. Algorithm Interview: Permutations of numbers
  7. How to Play WAV music under DOS?
  8. [Daily Problem] Course Prerequisites
  9. Daily Interview Problem: Contiguous Subarray with Maximum Sum
  10. Autorun.inf Virus Protection

Comments (0)

Your Email (Domain Part Not Exposed):

Your Comments:

Privately By Mail Colors More Smileys S x y @

Verification (Click Image 2 Refresh):

    Be the first one to comment this page !


Page Edited: October 30 2020 14:21:09 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />