Valid Parenthesis
Last updated
Last updated
Given a string that includes three types of brackets, (), [], and {}, determine if all brackets match in the correct order.
Create a Map<BracketType, Frequency>
then checking the frequency == 0
won't work because we also care about the order that they are in. In order to preserve this order, we put the open brackets into a stack then pop it to match with the closed brackets.
Main Function
Check if brackets match
"Easy" questions are as easy you think to make a one pass. The logic has to make perfect sense. Edges cases have to be all covered. No typos and grammar issues. Do not get lazy on testing manually. The ONLY way to make sure your programing works is to run through a couple examples.