NumPy allowed · plain Python earns 10 bonus points
Implement Valid Parentheses, the canonical stack problem used verbatim in compilers, linters, and expression evaluators.
Implement is_valid(s): push every opening bracket onto a stack. On a closing bracket, check the stack's top against a closer-to-opener map -- if it doesn't match (or the stack is empty), the string is invalid. Valid iff the stack is empty at the end.
is_valid(s: str) -> bool