Check If a Linked List is Palindrome or Not

In this tutorial, I am going to discuss a programming question Palindrome linked list and it’s implementation using java code.

Given a singly linked list, Write a code that returns true if the given linked list is a Palindrome else return false.

For example –

Example 1 –

1 -> 3 -> 4 -> 3 -> 1 -> NULL

It’s a palindrome.

Example 2 –

1 -> 3 -> 4 -> NULL

It’s not a palindrome.

NOTE: We have to solve this problem in O(n) time complexity and without using any extra space.