rewrite leetcode generate parentheses