GE Power Interview Question: Make a function to detect a p... |

Interview Question

Senior Back End Engineer Interview Querétaro, Querétaro (Mexico)

Make a function to detect a palindrome word using only one

  string variable (the one passed as a parameter).

Interview Answer

1 Answer


Using a for loop to compare each character of the word in a mirror-way, the first character against the last, the second against the second to last, and so on. Whenever a difference was found, the function returned false, otherwise, true was returned indicating the word was a palindrome.

Interview Candidate on 27-Mar-2017

Add Answers or Comments

To comment on this, Sign In or Sign Up.