재귀함수
[LeetCode] 326. Power of Three
326. Power of Three Easy Given an integer n, return true if it is a power of three. Otherwise, return false. An integer n is a power of three, if there exists an integer x such that n == 3x. Example 1: Input: n = 27 Output: true Explanation: 27 = 33 Example 2: Input: n = 0 Output: false Explanation: There is no x where 3x = 0. Example 3: Input: n = -1 Output: false Explanation: There is no x whe..
![[LeetCode] 323. Number of Connected Components in an Undirected Graph](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FQAK4h%2FbtrS5xkuAtL%2FAAAAAAAAAAAAAAAAAAAAACOGGc0Z74zCPGoa_F4C4_KqAv7mFQrNeBjylPcdIQqu%2Fimg.jpg%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DftcyFdnCJnbDW25WBwekkqfO2uI%253D)
[LeetCode] 323. Number of Connected Components in an Undirected Graph
323. Number of Connected Components in an Undirected Graph Medium You have a graph of n nodes. You are given an integer n and an array edges where edges[i] = [ai, bi] indicates that there is an edge between ai and bi in the graph. Return the number of connected components in the graph. Example 1: Input: n = 5, edges = [[0,1],[1,2],[3,4]] Output: 2 Example 2: Input: n = 5, edges = [[0,1],[1,2],[2..
![[LeetCode] 22. Generate Parentheses](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2F1B5Ac%2FbtrPyKAxYZN%2FAAAAAAAAAAAAAAAAAAAAAI96naLrobu-UT_ldenmSULR6geOXEvZP4ZdAALOp8f5%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DJNIg%252BrlwLgn0zmZt2gqMbNRwJ2U%253D)
[LeetCode] 22. Generate Parentheses
22. Generate Parentheses Medium Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Example 1: Input: n = 3 Output: ["((()))","(()())","(())()","()(())","()()()"] Example 2: Input: n = 1 Output: ["()"] Constraints: 1 cnt2: dfs(cnt1, cnt2 + 1, temp + ')') dfs(0, 0, '') return res