solve the generate parentheses