The whole problem fits in one sentence: given n pairs of parentheses, return every string of length 2n that is well-formed. Then the examples undercut you — for n = 3 there are five answers, for n = 4 ...
現在ITエンジニアとして働いていますが、コーディング・アルゴリズム力をもっと鍛えたいと思い、LeetCodeで学んだ内容をメモ的にアウトプットしています。 今回解いてみた問題は「22.Generate Parentheses」です。 class Solution: def generateParenthesis(self, n: int) -> List[str ...
I am currently working as an IT engineer, and I am outputting what I have learned on LeetCode as notes to further improve my coding and algorithm skills. The problem I solved this time is "22.