Pergunta de entrevista da empresa LBi Software

Write a Java method isPalindrome that checks if a given string is a palidrome or not.

Resposta da entrevista

Sigiloso

12 de abr. de 2019

You may use stacks for this question, but personally I like to use two ints s and t where one points to the beginning and the other points at the end respectively. And while s < t check if str.charAt(s)==str.charAt(t) if not return false, and increment s and decrement t. In the last line return true.