Palindrome Problem Linked List


In this question I divided the linked list into parts from the middle value and after reversing the second half, I compared it with the first half. For this solution, one of my test cases is showing wrong answer. How should I modify it?

Try for the following input
5
1 2 3 2 1
Your code is giving false, consider cases where total number of nodes can be odd.
You can also do it using recursion, as discussed in case of strings in class.
You can start 2 pointers from beginning and end, and then check if the front and last are equal and if the sublist is palindrome

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.