mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 11:43:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			40 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>给定一个链表的 <strong>头节点 </strong><code>head</code><strong> ,</strong>请判断其是否为回文链表。</p>
 | 
						||
 | 
						||
<p>如果一个链表是回文,那么链表节点序列从前往后看和从后往前看是相同的。</p>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>示例 1:</strong></p>
 | 
						||
 | 
						||
<p><strong><img alt="" src="https://pic.leetcode-cn.com/1626421737-LjXceN-image.png" /></strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong> head = [1,2,3,3,2,1]
 | 
						||
<strong>输出:</strong> true</pre>
 | 
						||
 | 
						||
<p><strong>示例 2:</strong></p>
 | 
						||
 | 
						||
<p><strong><img alt="" src="https://pic.leetcode-cn.com/1626422231-wgvnWh-image.png" style="width: 138px; height: 62px;" /></strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong> head = [1,2]
 | 
						||
<strong>输出:</strong> false
 | 
						||
</pre>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>提示:</strong></p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li>链表 L 的长度范围为 <code>[1, 10<sup><span style="font-size: 9.449999809265137px;">5</span></sup>]</code></li>
 | 
						||
	<li><code>0 <= node.val <= 9</code></li>
 | 
						||
</ul>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>进阶:</strong>能否用 O(n) 时间复杂度和 O(1) 空间复杂度解决此题?</p>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><meta charset="UTF-8" />注意:本题与主站 234 题相同:<a href="https://leetcode-cn.com/problems/palindrome-linked-list/">https://leetcode-cn.com/problems/palindrome-linked-list/</a></p>
 |