Loading
Loading
A configuration language uses three kinds of bracket: round, square and curly. A document is well formed when every opening bracket is closed by the matching kind, in the correct order, and nothing is left unclosed.
Return whether the given bracket string is well formed.
text = "{[()]}"stack: {open curlystack: { [open squarestack: { [ (open roundstack: { [) closes ( — matchemptyall closed in ordertrueSign in to keep a note here. It is free, and nobody else can see it.
Sign inExample 1
Sign in to open hints.
Struggling is where the learning happens. Open this once you have genuinely tried, or once the hints have run out.
O(n) time · O(n) space
Input. Run your code to watch it work on this input, one line at a time.
Running code is turned off on this deployment. You can still read the problem, write code, use hints and the visualizer.
Tab moves focus out of the editor. Press Ctrl+M to let Tab indent instead.
No results yet
Run your code against the sample tests, or submit to run the full suite.
Example 2
Correctly counted but incorrectly nested.
Example 3
Left open.