I'm trying to run a leetcode solution through a debugger so I can see how the solution works. Its number 20 on parenthesis. This is what I've plugged into the debugger..am I missing something?
class Solution:
def isValid(self, s: str) -> bool:
parenthesis = {"}":"{",
"]":"[",
")":"("
}
stack = []
for i in s:
if i in parenthesis:
if not stack or paren[i] != stack[-1]:
return False
else:
stack.pop()
else:
stack.append(i)
return stack == []
Solution.isValid("{[]}")
I've tried making an instance of the class but I still get the same issue.