From 7fac0b5f63cea669fa7337557f5102b5cf18c213 Mon Sep 17 00:00:00 2001 From: Meutel Date: Sun, 16 Jun 2019 16:09:17 +0200 Subject: [PATCH] Correction palindrome --- Palindrome.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Palindrome.java b/Palindrome.java index d5b4d7a..4f82fc5 100644 --- a/Palindrome.java +++ b/Palindrome.java @@ -7,7 +7,14 @@ public class Palindrome { } private static final boolean estPalindrome(char[] mot) { - return false; + for (int i=0; i < mot.length/2; i++) { + char c1 = mot[i]; + char c2 = mot[mot.length -i-1]; + if (c1 != c2) { + return false; + } + } + return true; } }