Question: Using Java Recursion please You are working on problem set: Chapter 12 (0 Pause) isPalindrome Language/Type: Related Links: Java recursion string return String 1 public

Using Java Recursion please Using Java Recursion please You are working on problem set: Chapter

You are working on problem set: Chapter 12 (0 Pause) isPalindrome Language/Type: Related Links: Java recursion string return String 1 public static boolean isPalindrome (String s) { 2 if (s.length() == 0 || s.length() ==1) { 3 return true; 4. } 5 if (s.charAt() == s.charAt(s.length()-1)){ 6 return isPalindrome (s.substring(1, s.length() - 1)); 7 } else { 8 return false; 9 } 10 } 11 12 13 14 15 16 17 18 19 20 Write a recursive method named ispalindrome that accepts a string parameter and returns true if the string is the same forwards as backwards, ignoring capitalization. For example, the call of ispalindrome ("Madam") should return true. Constraints: Do not declare any global variables or any auxiliary data structures. Do not use any loops; you must use recursion. Method: Write a Java method as described, not a complete program or class. Submit You passed 11 of 13 tests. Try again. isPalindrome ("madam") > true isPalindrome ("racecar") true * isPalindrome ("Step on NO PEts") false (expected true) * isPalindrome ("able was I ere I saw Elba") false (expected true) isPalindrome ("BB") true

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!