Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions Misc/Palindrome.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
class Palindrome {

public String reverseString(String x){ //*helper method
String output = "";
for(int i=x.length()-1; i>=0; i--){
output += x.charAt(i); //addition of chars create String
// palindrome method, returns true if x is palindrome
public boolean isPalindrome(String x){
if (x.length() == 0 || x.length() == 1) {
return true;
}
return output;
}


public Boolean isPalindrome(String x){ //*palindrome method, returns true if palindrome
return (x.equalsIgnoreCase(reverseString(x)));

if (x.charAt(0) != x.charAt(s.length() - 1)) {
return false;
}
return isPalindrome(x.substring(1, x.length() - 1));
}

}