Class Solution
-
- All Implemented Interfaces:
public final class Solution
234 - Palindrome Linked List\.
Easy
Given the
head
of a singly linked list, returntrue
if it is a palindrome orfalse
otherwise.Example 1:
Input: head = 1,2,2,1
Output: true
Example 2:
Input: head = 1,2
Output: false
Constraints:
The number of nodes in the list is in the range <code>1, 10<sup>5</sup></code>.
0 <= Node.val <= 9
Follow up: Could you do it in
O(n)
time andO(1)
space?
-
-
Constructor Summary
Constructors Constructor Description Solution()
-