mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 03:33:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			38 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>给你一个链表的头节点 <code>head</code>,请你编写代码,反复删去链表中由 <strong>总和</strong> 值为 <code>0</code> 的连续节点组成的序列,直到不存在这样的序列为止。</p>
 | 
						||
 | 
						||
<p>删除完毕后,请你返回最终结果链表的头节点。</p>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p>你可以返回任何满足题目要求的答案。</p>
 | 
						||
 | 
						||
<p>(注意,下面示例中的所有序列,都是对 <code>ListNode</code> 对象序列化的表示。)</p>
 | 
						||
 | 
						||
<p><strong>示例 1:</strong></p>
 | 
						||
 | 
						||
<pre><strong>输入:</strong>head = [1,2,-3,3,1]
 | 
						||
<strong>输出:</strong>[3,1]
 | 
						||
<strong>提示:</strong>答案 [1,2,1] 也是正确的。
 | 
						||
</pre>
 | 
						||
 | 
						||
<p><strong>示例 2:</strong></p>
 | 
						||
 | 
						||
<pre><strong>输入:</strong>head = [1,2,3,-3,4]
 | 
						||
<strong>输出:</strong>[1,2,4]
 | 
						||
</pre>
 | 
						||
 | 
						||
<p><strong>示例 3:</strong></p>
 | 
						||
 | 
						||
<pre><strong>输入:</strong>head = [1,2,3,-3,-2]
 | 
						||
<strong>输出:</strong>[1]
 | 
						||
</pre>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>提示:</strong></p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li>给你的链表中可能有 <code>1</code> 到 <code>1000</code> 个节点。</li>
 | 
						||
	<li>对于链表中的每个节点,节点的值:<code>-1000 <= node.val <= 1000</code>.</li>
 | 
						||
</ul>
 |