The Gate Keeper
A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- easy
- Seniority
- L4
Problem
An expression validator receives short strings built only from the bracket characters `()[]{}` and has to confirm each one is well-formed before it moves downstream. A string is valid when every opening bracket is closed by one of the same type in the correct order with nothing left open, so `([)]` fails even though the counts balance; an empty string counts as valid.
Summary
Not all openings have a closing.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.