The question is quite easy. Check whether a given string has valid parentheses. For example, { needs to match }, ( matches ) and [ matches ]. And you have to check whether they are in the right order. The follow-up question is to check the valid string again but with given pairs. Say the pairs are "ab cd". That means 'a' needs to match 'b' and 'c' needs to match 'd'.
Anonymous
Use hashmap to store pairs. Use stack to check the order.
Check out your Company Bowl for anonymous work chats.