Palindrome LL problem

working for only the first 2 test cases

Hey @bhattanurag426 give a brief about your approach. Cause i can see that it won’t give right answer.

some of current node and next node == node->next->next data

The goal to solve this problem is being Explained below.


You have to do it like this.
You can do either by reversing the linked list and then checking by their head individually. Or by using stack.

sir we have to check whether the linked list is palindrome or not

Yes, this is how you will do that. Understand it with example of string. String “aabbccbbaa” that means pointer from beginning till end and pointer from end till beginning until they become equal makes every character of that string equal. Same we are doing with linked list.

ok sir got it…

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.