Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to write method that check bracket in String are matched?

neonzneonz Member Posts: 1
How to write balancedBracketsByCounting(String s), as follows, that takes a string as an input and checks whether the brackets "[", "]", "(", and ")" in the string are matched correctly?

balancedBracketsByCounting("[x][[xy]]") would return True.
balancedBracketsByCounting("[[x[y]]") would return False.

Do we need to use Stack and Queue in our program?

Please assist, thanks.
Sign In or Register to comment.