| about | help | code help+videos | done | prefs |
isPalindrome
A String is said to be a palindrome if it remains unchanged when reversed.
String reverse(String s) {
String result = "";
for(int i=0; i < s.length(); i++) {
result = s.charAt(i) + result; //add later characters before earlier characters
}
return result;
}
isPalindrome("madam") → true isPalindrome("") → true isPalindrome("made! edam") → false ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 1 Post-solution available
Copyright Nick Parlante 2017 - privacy