Skip to content

Commit

Permalink
Update PalindromeChecker.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Ny09-sand authored Feb 8, 2025
1 parent 2d28fab commit 67bafe5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main/java/PalindromeChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,15 @@ public void tester()
public boolean palindrome(String word)
{
//your code here
return false;
return (word.equals(reverse(word)));
}
public String reverse(String str)
{
String sNew = new String();
//your code here
return sNew;
String s = new String("");
if (str.length()==0) {return "";}
for ( int i = str.length()-1; i >= 0 ; i --){
s+=str.substring(i,i+1);
}
return s;
}
}

0 comments on commit 67bafe5

Please sign in to comment.