mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 19:53:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			47 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>给定两个 <strong>非空链表</strong> <code>l1</code>和 <code>l2</code> 来代表两个非负整数。数字最高位位于链表开始位置。它们的每个节点只存储一位数字。将这两数相加会返回一个新的链表。</p>
 | 
						||
 | 
						||
<p>可以假设除了数字 0 之外,这两个数字都不会以零开头。</p>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>示例1:</strong></p>
 | 
						||
 | 
						||
<p><img alt="" src="https://pic.leetcode-cn.com/1626420025-fZfzMX-image.png" style="width: 302px; " /></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>l1 = [7,2,4,3], l2 = [5,6,4]
 | 
						||
<strong>输出:</strong>[7,8,0,7]
 | 
						||
</pre>
 | 
						||
 | 
						||
<p><strong>示例2:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>l1 = [2,4,3], l2 = [5,6,4]
 | 
						||
<strong>输出:</strong>[8,0,7]
 | 
						||
</pre>
 | 
						||
 | 
						||
<p><strong>示例3:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>l1 = [0], l2 = [0]
 | 
						||
<strong>输出:</strong>[0]
 | 
						||
</pre>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>提示:</strong></p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li>链表的长度范围为<code> [1, 100]</code></li>
 | 
						||
	<li><code>0 <= node.val <= 9</code></li>
 | 
						||
	<li>输入数据保证链表代表的数字无前导 0</li>
 | 
						||
</ul>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>进阶:</strong>如果输入链表不能修改该如何处理?换句话说,不能对列表中的节点进行翻转。</p>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><meta charset="UTF-8" />注意:本题与主站 445 题相同:<a href="https://leetcode-cn.com/problems/add-two-numbers-ii/">https://leetcode-cn.com/problems/add-two-numbers-ii/</a></p>
 |