We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
If the current character is a closed bracket and he must be } but the last pushed character in stack is ) or ] so we can deduce that the expression is not balanced.
Sample test case: {[()[}]}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Stacks: Balanced Brackets
You are viewing a single comment's thread. Return to all comments →
If the current character is a closed bracket and he must be } but the last pushed character in stack is ) or ] so we can deduce that the expression is not balanced. Sample test case: {[()[}]}