Microsoft Interview Question

Write a function to check if a string is a palindrome or not

Interview Answers

Anonymous

Oct 1, 2018

In Python: def IsPalidrome(test_string): return test_string == test_string[::-1]

Anonymous

Oct 2, 2018

In cpp bool isPalindrome(string s){ int r = s.length() - 1, l = 0; while (l < r){ if(s[l] != s[r]){ return False; } l++; r--; } }