mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-04 23:11:41 +08:00
update
This commit is contained in:
27
leetcode/problem/palindrome-linked-list.html
Normal file
27
leetcode/problem/palindrome-linked-list.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<p>Given the <code>head</code> of a singly linked list, return <code>true</code> if it is a palindrome.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
<img alt="" src="https://assets.leetcode.com/uploads/2021/03/03/pal1linked-list.jpg" style="width: 422px; height: 62px;" />
|
||||
<pre>
|
||||
<strong>Input:</strong> head = [1,2,2,1]
|
||||
<strong>Output:</strong> true
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
<img alt="" src="https://assets.leetcode.com/uploads/2021/03/03/pal2linked-list.jpg" style="width: 182px; height: 62px;" />
|
||||
<pre>
|
||||
<strong>Input:</strong> head = [1,2]
|
||||
<strong>Output:</strong> false
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li>The number of nodes in the list is in the range <code>[1, 10<sup>5</sup>]</code>.</li>
|
||||
<li><code>0 <= Node.val <= 9</code></li>
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
||||
<strong>Follow up:</strong> Could you do it in <code>O(n)</code> time and <code>O(1)</code> space?
|
Reference in New Issue
Block a user