算法:链表 Linked list
题目:Add Two Numbers
url:https://leetcode.com/problems/add-two-numbers/
1 | 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. |
分析
- 百位大数相加
Java解法
方法 | 定义 |
---|---|
链表增加节点 | |
单链表反转 | 不需要,只是为了练习算法 |
遍历链表 |
1 | package com.test.demo; |
Python解法