GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • 注册
  • Plus 会员

This view

  • Original page
  • New address

GeezerVison is showing leetcode.cn — LCR 025. 两数相加 II - 力扣(LeetCode)

题目描述
题目描述
题解
题解
提交记录
提交记录
LCR 025. 两数相加 II
中等

给定两个 非空链表 l1和 l2 来代表两个非负整数。数字最高位位于链表开始位置。它们的每个节点只存储一位数字。将这两数相加会返回一个新的链表。

可以假设除了数字 0 之外,这两个数字都不会以零开头。

 

示例 1:

输入:l1 = [7,2,4,3], l2 = [5,6,4]
输出:[7,8,0,7]

示例 2:

输入:l1 = [2,4,3], l2 = [5,6,4]
输出:[8,0,7]

示例 3:

输入:l1 = [0], l2 = [0]
输出:[0]

 

提示:

  • 链表的长度范围为 [1, 100]
  • 0 <= node.val <= 9
  • 输入数据保证链表代表的数字无前导 0

 

进阶:如果输入链表不能修改该如何处理?换句话说,不能对列表中的节点进行翻转。

 

注意:本题与主站 445 题相同:https://leetcode.cn/problems/add-two-numbers-ii/

 
代码
代码
测试用例
测试用例
测试结果
测试结果
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.