Convert the number string


#1

Convert the number into a string then check whether the string is palindrome or not.


#2

Wouldn’t you count it as an extra space? Since it is basically an array of chars of the number of digits.


#3
string s=to_string(A);
int i,j,k=0,ans; int l=s.length();   vector <int> v;
for(i=0;i<l/2;i++)
{if(s[i]==s[l-1-i])
k++;}
//cout<<s[l-1];
//cout<<k;
if(k==l/2)
return 1;
else 
return 0;

#4

Yes, it does.
For your own benefit, always see if it is running with extra space. Many times it happens that in coding exams these constraints are not hardly implemented. You will miss out marks just because others wrote it using space.


#5

Wat!!!. I wasted 30min by not using extra space. They should implement their own rules or else it would be unfair to others who follows rules.