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

30:00

Palindrome Linked List
easy
Topics
Companies

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

Example 1:
Input: [1,2,2,1]
Output: true
Constraints:
  • The number of nodes is in the range [1,105][1, 10^5].

  • 0Node.val90 \leq \text{Node.val} \leq 9

Input
arr =[1,2,2,1]
slowfast

1

2

2

1

Find middle with slow/fast pointers

Variables
VariableValue
slow0
fast0
DepthFunction Call
Stack empty
0/6