Arista Networks interview question

implement a function that determines a string is whether a palindrome or not

Interview Answers

Anonymous

24 Oct 2017

I wrote a recursive function that gets a string, starting point and ending point.

Anonymous

12 Dec 2017

#include #include main() { char str[]="abcbba"; int len=0; len=strlen(str); for(int i=0;i<=len/2;i++) { if(str[i] != str[(len-i)-1]) { printf("The string is not a palindrome\n"); return; } } printf("The string is a palindrome\n"); }

Anonymous

12 Dec 2017

#include #include main() { char str[]="abcbba"; int len=0; len=strlen(str); for(int i=0;i<=len/2;i++) { if(str[i] != str[(len-i)-1]) { printf("The string is not a palindrome\n"); return; } } printf("The string is a palindrome\n"); }