Palindrome Checker with Wildcard
Time: 45 minutes
Difficulty: Easy/Medium
Languages: Any
====================
Given a string that may contain lowercase English letters and a special wildcard character '*', implement a function that determines if the string is a palindrome. The wildcard character '*' can match any single character.
For example:
- "racecar" is a palindrome.
- "r*cecar" is a palindrome ('*' matches 'a').
- "r*cec*r" is a palindrome (both '*' match 'a').
- "hello" is not a palindrome.
- "h*llo" is not a palindrome (no single character can make it a palindrome).
- "a*" is a palindrome ('*' matches 'a').
- "*" is a palindrome ('*' matches itself or any single character).
Write a function is_wildcard_palindrome(text: str) -> bool
that returns True
if the string is a palindrome considering the wildcard, and False
otherwise.
====================
Please answer to this message with your solution 💡❤️🚀
>>Click here to continue<<