Question: Write a RECURSIVE method that accepts a string s and returns true if the string is a palindrome ( reads the same forwards and backwards
Write a RECURSIVE method that accepts a string s and returns true if the string is a palindrome reads the same forwards and backwards and false otherwise. Also this string s must not contain any numbers. Use Character isDigit in your code. Examples: isPalindromeracecar true isPalindromehello false isPalindromea true isPalindrome" true Constraints: Ignore casf sensitivity eg "RaceCar" should also return true The method should only use recursion no loops Your code must contain these: Error condition: when the string contains numbers, return immediately. So you must check this first. Use Character.isDigit in your code Convert the string into all lowercase immediately. Check the first and last characters of the string. Recursively call the substring that excludes these two characters. Base case: What happens when the string is empty or has only one character?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
