Pregunta de entrevista de Google

Write a function to determain if a string is Palindrome?

Respuestas de entrevistas

Anónimo

18 de mar de 2015

use two pointer left and right in a while loop. check whether char at left equals to right. if yes, left++ and right--, if not, return false.

1

Anónimo

20 de sept de 2015

public static boolean isPalindrome(String text, int start, int end){ if (text == null) { return false; } if (start >= end) { return true; } if (text.charAt(start) != text.charAt(end)) { return false; } return isPalindrome(text,start+1,end-1); }