Question d’entretien chez Meta

Write a function to determine if a string is a palindrome

Réponse à la question d'entretien

Utilisateur anonyme

13 oct. 2015

public boolean isPalindrome(String str) { int length = str.length(); for (int x = 0; x < length / 2; x++) { if (str.charAt(x) != str.charAt(length - 1 - x)) return false; } return true; }

1