Pergunta de entrevista da empresa Meta

Given a string, determine if it is a palindrome.

Respostas da entrevista

Sigiloso

25 de ago. de 2019

str="ANna".lower() len=len(str) slicedString = str[ len::-1 ] for i in str: if i.isdigit(): raise Exception ("{0} not string".format(str)) if str == slicedString: print("{1} is palindrome for {0}".format(str,slicedString)) else: print("Not palindrome")

Sigiloso

28 de jul. de 2020

bool isPalindrome(string s) { int start = 0, end = s.length() - 1; while (start <= end) { if (s[start++] != s[end--]) { return false; } } return true; } int main() { string s = "HBKH"; cout << "isPlanlindrome = " << isPalindrome(s); }