A HACKERBREWERY ORIGINAL
Keep it together
EasyStringsStacks
A tiny language uses round, square, and curly brackets. Given a string containing only these brackets, return true if every opening bracket is closed by the matching type, in the correct order. The empty string is balanced.
Example 1
INPUT
"{[()]}"OUTPUTtrueEvery pair closes in the reverse order in which it opens.
Example 2
INPUT
"([)]"OUTPUTfalseThe round bracket closes before the inner square bracket.
Keep in mind
- 0 ≤ text.length ≤ 10,000
- The string contains only (, ), [, ], {, and }.
Draft saved on this browserSpaces: 2 UTF-8
INPUT
"{[()]}"EXPECTED OUTPUT
truePublic samples only. These checks do not award ranked points.