Bootcamps
Masterclasses
Menu
Courses
Account
Login / Sign Up

Check if Linked List is Palindrome

Medium Acceptance 67% Points 30

You are given the head of a singly linked list. Your task is to determine whether the linked list forms a palindrome. Return true if it reads the same forward and backward; otherwise, return false.

Examples
Example 1

Example 1

Input: head = [1,2,2,1]

Output: true

Explanation: The linked list reads the same from left to right and right to left.

Example 2

Example 2

Input: head = [1,2,3,2,1]

Output: true

Explanation: The linked list is symmetric, so it is a palindrome.

Example 3

Example 3

Input: head = [1,2,3]

Output: false

Explanation: The linked list does not read the same in both directions.

Constraints
  • 1 = Number of nodes = 105
  • -10? = Node.data = 10?
Topics
Linked List
Companies
Apple
Added 25 Jul 2026 67% acceptance
Ln 1, Col 1Sign in to save your code
1 2 2 1
true