Soal
00:00

17. Generate Parentheses

SedangBacktrackingAmazonGoogleMicrosoft

Given n pairs of parentheses, generate all combinations of well-formed parentheses.

Contoh 1:

Input: n = 3
Output: ["((()))","(()())","(())()","()(())","()()()"]

Contoh 2:

Input: n = 1
Output: ["()"]

Batasan:

  • 1 <= n <= 8
Mode kode inti
● Tersimpan otomatisBaris 1, kolom 1