Pergunta de entrevista da empresa SAP Concur

Explain how a function would look to check if a string is palindrome.

Resposta da entrevista

Sigiloso

19 de abr. de 2017

You could check for the length of the string - if it is even, divide by 2 Then check the character at the maximum length of that substring and another at the substring max length + 1 Keep checking at two points: from the substring maximum length - 1, then the substring max length + 1 (adding 1 each time) If the two characters all match by the time the first check reaches 0 and the string length maximum, then the string is palindromic