Closing Time
A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- easy
- Seniority
- junior
Problem
Our query layer gates filter expressions before the parser sees them: each expression groups conditions with round, square, and curly brackets, and the gate confirms every opener is closed by the matching kind in the right order. Bracket characters inside a single-quoted string value are literal data, so they are ignored along with all other non-bracket characters. Return whether the brackets are balanced; an expression with no brackets is balanced.
Summary
Every bracket you open is a promise. Check that the parser keeps all of them.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.