Implement power and balance-parentheses algorithms | Meta Interview Question