|
| 1 | +<h2><a href="https://leetcode.com/problems/palindrome-linked-list">Palindrome Linked List</a></h2> <img src='https://img.shields.io/badge/Difficulty-Easy-brightgreen' alt='Difficulty: Easy' /><hr><p>Given the <code>head</code> of a singly linked list, return <code>true</code><em> if it is a </em><span data-keyword="palindrome-sequence"><em>palindrome</em></span><em> or </em><code>false</code><em> otherwise</em>.</p> |
| 2 | + |
| 3 | +<p> </p> |
| 4 | +<p><strong class="example">Example 1:</strong></p> |
| 5 | +<img alt="" src="https://assets.leetcode.com/uploads/2021/03/03/pal1linked-list.jpg" style="width: 422px; height: 62px;" /> |
| 6 | +<pre> |
| 7 | +<strong>Input:</strong> head = [1,2,2,1] |
| 8 | +<strong>Output:</strong> true |
| 9 | +</pre> |
| 10 | + |
| 11 | +<p><strong class="example">Example 2:</strong></p> |
| 12 | +<img alt="" src="https://assets.leetcode.com/uploads/2021/03/03/pal2linked-list.jpg" style="width: 182px; height: 62px;" /> |
| 13 | +<pre> |
| 14 | +<strong>Input:</strong> head = [1,2] |
| 15 | +<strong>Output:</strong> false |
| 16 | +</pre> |
| 17 | + |
| 18 | +<p> </p> |
| 19 | +<p><strong>Constraints:</strong></p> |
| 20 | + |
| 21 | +<ul> |
| 22 | + <li>The number of nodes in the list is in the range <code>[1, 10<sup>5</sup>]</code>.</li> |
| 23 | + <li><code>0 <= Node.val <= 9</code></li> |
| 24 | +</ul> |
| 25 | + |
| 26 | +<p> </p> |
| 27 | +<strong>Follow up:</strong> Could you do it in <code>O(n)</code> time and <code>O(1)</code> space? |
0 commit comments