185. Palindrome Linked List

EasyLinked List

Given the head of a singly linked list, return true if it is a palindrome or false otherwise.

Examples

Input: [1,2,2,1]

Output: true

Explanation: Reads the same forward and backward.

Constraints

  • The number of nodes in the list is in the range [1, 10^5].
  • 0 <= Node.val <= 9
Loading...

Run checks all cases above. Submit evaluates all test cases.