Stacks and Queues Exercise 6. Balanced Parentheses.
https://pastebin.com/cKze7KaJ
87/100 не мога да видя кой случай пропускам. Ако някой може да удари едно рамо. :)
Given a sequence consisting of parentheses, determine whether the expression is balanced. A sequence of parentheses is balanced if every open parenthesis can be paired uniquely with a closed parenthesis that occurs after the former. Also, the interval between them must be balanced.
You will be given three types of parentheses: (, {, and [.
{[()]} - This is a balanced parenthesis.
{[(])} - This is not a balanced parenthesis.
Input |
Output |
{[()]} |
YES |
{[(])} |
NO |
{{[[(())]]}} |
YES |
https://judge.softuni.bg/Contests/Practice/Index/1442#5