Problem Statement | |||||||||||||
A series of brackets is complete if we can pair off each left bracket '[' with a right bracket ']' that occurs later in the series. Every bracket must participate in exactly one such pair. Given a String text add the minimal number of brackets to the beginning and/or end of text to make it complete. Return the result. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | text will have between 1 and 50 characters inclusive. | ||||||||||||
- | text will contain only the characters '[' and ']'. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
|