Palindrome String - II
You are given a string s. Using recursion, determine whether s is a palindrome.
A palindrome reads exactly the same from left to right and from right to left. The comparison is case-sensitive, so uppercase and lowercase letters are considered different characters.
Note:
A normal iterative solution will pass the test cases, but the goal of this problem is to solve it using recursion and strengthen your understanding of recursive calls and base cases.
Example 1:
Input: s = "racecar"
Output: true
Explanation: Reading racecar in either direction produces the same string.
Example 2:
Input: s = "Madam"
Output: false
Explanation: The comparison is case-sensitive, so uppercase M and lowercase m do not match.
Now Your Turn!
Pick the correct output for the given inputInput: s = "Level"
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 1 <= s.length <= 100
- s contains only uppercase English letters, lowercase English letters, and digits.