Palindrome Linked List

Hard

Question

Given the head of a linked list of integers, return True if it's a palindrome, otherwise return False.

A linked list is a palindrome if it sequence of nodes reads the same forwards and backwards.

Palindrome Linked List Example 1

Input: head = [4 -> 7 -> 7 -> 4]

Output: True

Palindrome Linked List Example 2

Input: head = [4 -> 7 -> 7]

Output: False

Follow up: Could you solve this in O(n) time and O(1) space?

Clarify the problem

What are some questions you'd ask an interviewer?

Understand the problem

Which of these linked lists is *not* a palindrome?
[]
[7 -> 11 -> 11]
[1 -> 2 -> 3 -> 2 -> 1]
[1 -> 2 -> 3 -> 3 -> 2 -> 1]

Login or signup to save your code.

Notes