Linked list palandrome question

some of the test cases not running

i have kept a pointer x to move it to the last of the linked list and compare data of head and last element
Then i have delete x that is the last element and made a recursive call by passing head->next as argument

hello @shabadsingh dont you think that you are complecating the code unnecessarily .
you can code for that in the way like if you can reverse the linked list and then compare the head of changed linked list and the original linked list and if at any point you find that the elements are not equal then you can return false at that time .
please reply here if you still have doubt in completing the code.
though i have made changes in your code .


i hope i have cleared your doubt .
Happy Learning !!

@tusharaggarwal272 the code which you have corrected is showing segmentation fault for true cases

@shabadsingh check now .

if you feel your doubt is cleared please mark this as resolved .
Happy Learning !!

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.