LINE Interview Question

Leet code medium Generate Parentheses.