please explain....the code #include<string> using namespace std; int main() { int x=0; string str; cin>>str;//only lowercase for(int i=0;i<str.size();i++) x^=(1<<(str[i]-97)); if(str.size()&1) { if(!(x&(x-1)))cout<<"Palindrome\n"; else cout<<"Not palindrome\n"; }
else { if(!x)cout<<"Palindrome\n"; else cout<<"Not palindrome\n"; } } i could not understand the algo On Jul 26, 11:07 am, Anika Jain <anika.jai...@gmail.com> wrote: > int palin(char *p) > { > int x=0; > while(*p) > { > x^=1<<(*p-'a'); > p++; > } > int i=0,count=0; > while(i<26) > { > count+=(1<<i & x)>>i; > i++; > } > if(count>1) > return 0; > else > return 1; > > > > > > > > } -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.