Hi, I need to write an algorithm balancedBracketsByCounting (String s), as follows, that takes a string as an input and checks whether the brackets "[" and "]" in the string are matched correctly.
For example, balancedBracketsByCounting("[x][[xy]]") would return true but balancedBracketsByCounting("[[x[y]]") would return false.
Do I need to use stack or queue?
Please assist!
Thanks.