Class Solution
-
- All Implemented Interfaces:
public final class Solution234 - Palindrome Linked List\.
Easy
Given the
headof a singly linked list, returntrueif it is a palindrome orfalseotherwise.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()
-