class Solution:
def isMatch(self, s: str, p: str) -> bool:
sr = [False for i in range(len§)]
strg = [sr for i in range(len(s))]
def match(cr, cc):
nonlocal s
nonlocal p
if cc == len(p):
return cr == len(s)
if strg[cr][cc] is True:
return False
first_match = cr < len(s) and (s[cr] == p[cc] or p[cc] == '.')
if cr < len(s):
strg[cr][cc] = True
if len(p) - cc >= 2 and p[cc + 1] == '*':
my_check = match(cr, cc + 2) or (first_match and match(cr + 1, cc))
return my_check
else:
if first_match is False:
return False
return match(cr + 1, cc + 1)
return match(0, 0)
s = Solution()
print(s.isMatch(‘aaa’, ‘a*’))
code not working and i have tried it 100 times