Question: Write a recursive method isPalindrome()that returns true if the given list is palindrome, else false.A palindrome is a word, phrase, number or sequence of words
Write a recursive method isPalindrome()that returns true if the given list is palindrome, else false.Apalindromeis a word, phrase, number or sequence of words that reads the same backward as forward.
Example:
Input: ["java"] Output: true Input: ["java", "python", "java"] Output: true Input: ["java", "python", "python", "java"] Output: true Input: ["java", "java", "python"] Output: false Input: ["python", "java"] Output: false
Here is the method header:
// Precondition: list.size() >= 1 && all strings are lowercase public static boolean isPalindrome(Listlist) { /* Your recursive code */ }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
