Amazon interview question

1. Expand parenthesis -Leet code medium