You are viewing a single comment's thread. Return to all comments →
The idea is to delete all pairs (), [], and {}. Once there are no open-close pairs and string is empty - the expression was correct.
For example you have string "[][{}({})]". The steps will be:
In other words we are interested only in open-close pair. If open does not have close near it - the expression is not correct.
Seems like cookies are disabled on this browser, please enable them to open this website
Java Stack
You are viewing a single comment's thread. Return to all comments →
The idea is to delete all pairs (), [], and {}. Once there are no open-close pairs and string is empty - the expression was correct.
For example you have string "[][{}({})]". The steps will be:
In other words we are interested only in open-close pair. If open does not have close near it - the expression is not correct.