Update Palindrome.java

Test cases where String x is null or has a length of 0 or 1 for FirstWay method.
This commit is contained in:
jasonptong
2018-12-22 17:27:31 -08:00
committed by GitHub
parent 084548d96e
commit a5bf69fcbd

View File

@ -10,6 +10,8 @@ class Palindrome {
public Boolean FirstWay(String x){ //*palindrome method, returns true if palindrome
if(x == null || x.length() <= 1)
return true;
return (x.equalsIgnoreCase(reverseString(x)));
}