Given a non-negative number represented as a singly linked list of digits, plus one to the number. The digits are stored such that the most significan ...
分类:
其他好文 时间:
2016-06-29 13:05:58
阅读次数:
148
Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit is a ...
分类:
其他好文 时间:
2016-06-24 23:39:28
阅读次数:
190
Plus One 本题收获 1.vector<int> 和vector<char>的区别,及与int转换 从vector<int> nums 转换为int res型,直接for循环 res += nums[i];(nums中的数本就是int型,不需要再-‘0’,char型则需要用nums[i] 的A ...
分类:
其他好文 时间:
2016-06-20 18:29:03
阅读次数:
184
Plus One
首先解释一下这个题的意思:一个非负数的内容从高位到低位(十进制位)依次放到数组的每一位,例如:123,存放到数组中就是[1,2,3],现在将这个数加 1 ,返回加1后的结果,如[1,2,3]应该返回[1,2,4].
弄清楚了题意以后解题就变得简单了,这个题的思路是从最低位开始,将它加1,若产生进位就依次往高位处理进位,直到没有进位为止。
有一点需要注意...
分类:
其他好文 时间:
2016-06-18 15:36:56
阅读次数:
140
1. 问题描述 Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant di ...
分类:
其他好文 时间:
2016-06-15 23:36:02
阅读次数:
121
题目: Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit ...
分类:
其他好文 时间:
2016-06-14 08:51:28
阅读次数:
116
这题需要注意的是最后的进位 vector<int> plusOne(vector<int>& nums,int num) { add(nums, num); } void add(vector<int> &nums, int num) { int c = num; for (auto it = nu ...
分类:
其他好文 时间:
2016-05-16 14:27:19
阅读次数:
123
Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit is a ...
分类:
编程语言 时间:
2016-05-03 16:01:40
阅读次数:
162
Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit is a ...
分类:
其他好文 时间:
2016-04-28 12:19:23
阅读次数:
160