Balanced Paranthesis

Given a string expression, check if brackets present in the expression are balanced or not. Brackets are balanced if the bracket which opens last, closes first.

You need to return true if it is balanced, false otherwise.

Note: This problem was asked in initial rounds in Facebook

Note:- I try to solve this problem using Linked List, python Queue, and List

Sample Input 1 :
{ a + [ b+ (c + d)] + (e + f) }
Sample Output 1 :
true
Sample Input 2 :
{ a + [ b - c } ]
Sample Output 2 :
false

Comments

Popular posts from this blog

How to pass parameters in webhook?

Access and modify all the resources of our Wiki.js using WikiJS API

Fahrenheit to Celsius