| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
- sorting
- binary search
- 쉬움
- linked list
- hash table
- leetcode
- tree
- 미디움
- list
- 리트코드
- backtracking
- string
- dfs
- HashTable
- 중간
- math
- two pointers
- 이진트리
- 재귀
- Python
- matrix
- DP
- easy
- binary tree
- Array
- Depth-first Search
- Binary
- recursive
- 문자열
- Medium
- Today
- Total
목록dynamicprogramming (3)
부부의 코딩 성장 일기
1. 문제 링크 https://leetcode.com/problems/generate-parentheses Generate Parentheses - LeetCode Can you solve this real interview question? Generate Parentheses - Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Example 1: Input: n = 3 Output: ["((()))","(()())","(())()","()(())","()()()"] Exa leetcode.com 2. 문제 설명 주어진 n쌍의 괄호로, 올바르게 구성된 괄호의 모든 조..
1. 문제 링크 https://leetcode.com/problems/longest-palindromic-substring/ str: result_len = 0 #대칭인 문자열의 길이 result ='' #대칭인 문자열 if len(s)= 0 and j < n and s[i] == s[j]: i, j = i - 1, j + 1 return s[i + 1:j] for k in range(n): ans = max(helper(k, k), helper(k, k + 1), ans, key=len) # helper(k, k) for odd length, helper(k, k+1) for even length return ans 5. 배운 점 확실히 난이도가 medium인 문제들은 단순히 이중 삼중 포문으로는 ti..
1. 문제 링크 https://leetcode.com/problems/climbing-stairs/ 2. 문제 설명 계단을 n steps에 거쳐 올라가며, 한번에 1 or 2 steps 씩밖에 오르지 못할 때, n개 계단을 오르는 방법의 수를 반환 예시1) n=2 이면 1step + 1step / 2steps 이렇게 두가지 방법이 가능하므로 2를 반환 예시2) n=3 이면 1step + 1step + 1step / 1step + 2steps / 2steps + 1steps 세 방법이 가능하므로 3을 반환 → 규칙을 찾아야하는 문제 3. 처음 풀이 2~7 steps 까지를 나열해보며 규칙을 찾았다. (물론 더 쉬운 규칙이 있었음) 3 step = 1 step으로 3번 움직이거나, 2step과 1step으로..