Python data engineering interview problem. Difficulty: beginner. Pattern: Stacks. About 10 minutes. Free to practice.
Check whether brackets are correctly matched and nested. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.
Implement valid_parentheses(s: str) -> bool for (), [], {}. , "(]" → False.
Input: valid_parentheses('()[]{}') Output: True Each close matches the latest open.
Topics: lakebench, python, stack, brackets.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Check whether brackets are correctly matched and nested.
Implement `valid_parentheses(s: str) -> bool` for (), [], {}. Example: `"()[]{}"` → `True`, `"(]"` → `False`. Keep the harness.