The Brackets Problem
Start Timer
0:00:00
You’re given a string that may contain the characters {, }, [, ], (, and ).
Task: Verify that the string is balanced. A balanced string is one where every opening character, {, [, or (, has a corresponding closing character, }, ], or ).
Write a function called is_balanced(string: str) -> bool which verifies the balance of a string.
Example:
is_balanced('(())[]{}') -> True
is_balanced('{([(){}])()}') -> True
is_balanced('{}[]())') -> False
.
.
.
.
.
.
.
.
.
Comments