Zero to Hero
article thumbnail
22. Generate Parentheses
Algorithm 2021. 4. 5. 13:30

Generate Parentheses - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 1. Brute Force (특정 길이의 괄호 문자열을 전부 만들고 적합한지 판단) from typing import * class Solution: answer = [] def generateParenthesis(self, n: int) -> List[str]: self.answer=[] self.dfs("", n) return self.answer def dfs(self,..