代码维护于GitHub:https://github.com/zrxJuly/data-structure
Coding Question:
Given a non-empty array of digits representing a non-negative integer, plus one to the integer.
The digits are stored such that the most significant digit is at the head of the list, and each element in the array contain a single digit.
You may assume the integer does not contain any leading zero, except the number 0 itself.编程题:
给定一个由整数组成的非空数组所表示的非负整数,在该数的基础上加1.
最高位存放于数组首位,并且数组中的每个元素只包含一个数字.
你可以假设该整数除了整数0之外,不会以0开头.
例如:
1 | 输入:[1,2,3] |
代码:
1 | public class PlusOne { |