Palindrome no o/p


not getting True as output, can you point out why?

Hello @mddanish,

The actual error in your code is not what you have pointed out.
It is not even printing the value “False” for the testcases like:

6
1 2 3 4 5 1

4
3 1 2 3

Have you observed something,

  1. If the first element is same as the last element, then it won’t print anything.
  2. Else, it would print false, irrespective of the other elements of the linked list.

Reason:
A syntax error that is causing the program to terminate for the case 1.

	if(temp->data != st.top())
		cout<<"False\n";
		return;

You are missing the braces.

Hope, this would help.
Give a like, if you are satisfied.