Solution: Palindrome Linked List

Let's solve the Palindrome Linked List problem using the Fast and Slow Pointers pattern.

Statement

Given the head of a linked list, your task is to check whether the linked list is a palindrome or not. Return TRUE if the linked list is a palindrome; otherwise, return FALSE.

Note: The input linked list prior to the checking process should be identical to the list after the checking process has been completed.

Constraints:

Let n be the number of nodes in a linked list.

  • 1≤1 \leq n ≤500\leq 500

  • 0≤0 \leq Node.value ≤9\leq 9.

Solution

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.