Determine feasibility and clean parentheses string | Meta Interview Question