Solution for question Generate Parentheses