title | tags | categories | author | comments | updated | permalink | mathjax | top | description | date | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|
[0369] 给单链表加一 |
|
|
张学志 |
true |
false |
false |
false |
... |
2019-12-31 16:06:09 -0800 |
用一个 非空 单链表来表示一个非负整数,然后将这个整数加一。
你可以假设这个整数除了 0 本身,没有任何前导的 0。
这个整数的各个数位按照 高位在链表头部、低位在链表尾部 的顺序排列。
示例:
输入: [1,2,3] 输出: [1,2,4]
Related Topics
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* plusOne(ListNode* head) {
}
};