Only two test cases are showing correct answer. Please help.
Is Palindrome doubt1
hey @Rooopak_Sharma, it is giving wrong answer for string as while comparing you have to convert them into int. Store the number in int array.
Here is your updated code.
But for the numbers also sir comparison would be same as well ( say ‘5’ = ‘5’). Can you give me a example where the code goes wrong?
hey @Rooopak_Sharma,as you are using string, it will read one line only, but input are in different line. It is considering first number only.
Consider this case
2
3
2
string s is storing only 3 here and giving output as true because all one digit number are pallindrome iteself.
If you do cout<<s.length(); you will find output as 1 irresepective the value of N.
Thatswhy use array.