LeetCode算法入门- Add Two Numbers-day3
生活随笔
收集整理的這篇文章主要介紹了
LeetCode算法入门- Add Two Numbers-day3
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
LeetCode算法入門- Add Two Numbers-day3
Add Two Numbers
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
Example:
Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
Output: 7 -> 0 -> 8
Explanation: 342 + 465 = 807.
solution:
主要注意兩個問題:進位問題;鏈表長度不同問題。
總結(jié)
以上是生活随笔為你收集整理的LeetCode算法入门- Add Two Numbers-day3的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java 多线程 —— 常用并发容器
- 下一篇: Git初学札记(一)————Git简介与