Balanced brackets
Determine whether a generated string of brackets is balanced; that is, whether it consists entirely of pairs of opening/closing brackets (in that order), none of which mis-nest.
Examples:
Input | Output |
---|---|
[] |
true |
][ |
false |
[][] |
true |
][] |
false |
[]][[] |
false |
[[[[]]]] |
true |
Test
{{test}}Console output