Check if a linked list of strings form a palindrome

Given a linked list handling string data, write a function to check whether the data forms a palindrom or not



The string represented in above list is a palindrome

In the above example we can see that the string "bacdcab" is a palindrome


1. Construct a string from the data in all nodes in the linked list ie, use append() function

2. Traverse the string and compare respective first and last character ie, str[i] = str[length-i-1].If they are not equal, then it is not a palindrome.

Next > < Prev
Scroll to Top