diff --git a/3-linear-data-structures/ch10/26-1.py b/3-linear-data-structures/ch10/26-1.py index 209cf71..9896d9c 100644 --- a/3-linear-data-structures/ch10/26-1.py +++ b/3-linear-data-structures/ch10/26-1.py @@ -1,9 +1,9 @@ -# Definition for singly-linked list. +# Definition for doubly-linked-list. class ListNode: def __init__(self, x): self.val = x - self.next = None - + self.right = None + self.left = None class MyCircularDeque: def __init__(self, k: int): diff --git a/5-algorithms/ch17/60-1.py b/5-algorithms/ch17/60-1.py index 82bd1c2..58edff0 100644 --- a/5-algorithms/ch17/60-1.py +++ b/5-algorithms/ch17/60-1.py @@ -15,4 +15,4 @@ def insertionSortList(self, head: ListNode) -> ListNode: cur.next, head.next, head = head, cur.next, head.next cur = parent - return cur.next + return cur.next diff --git a/5-algorithms/ch23/85-3.py b/5-algorithms/ch23/85-3.py index 84d1723..e56a162 100644 --- a/5-algorithms/ch23/85-3.py +++ b/5-algorithms/ch23/85-3.py @@ -5,6 +5,7 @@ class Solution: dp = collections.defaultdict(int) def fib(self, N: int) -> int: + self.dp[0] = 0 self.dp[1] = 1 for i in range(2, N + 1): diff --git a/README.md b/README.md index b372ebd..f0a4055 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,11 @@ - - -- [파이썬 알고리즘 인터뷰](#파이썬-알고리즘-인터뷰) - - [문제 풀이](#문제-풀이) - - [기타 코드](#기타-코드) - - [리트코드 변경 사항](#리트코드-변경-사항) - - - # 파이썬 알고리즘 인터뷰 95가지 알고리즘 문제 풀이로 완성하는 코딩 테스트 -![책표지](http://docs.likejazz.com/images/2020/book-cover.jpg) +★ 안내: 2023년 9월, [《자바 알고리즘 인터뷰 with 코틀린》](https://github.com/onlybooks/java-algorithm-interview) 신간이 출간되었습니다! + + + 《파이썬 알고리즘 인터뷰》는 다음 판매처에서 구매하실 수 있습니다. - [교보문고](https://bit.ly/3feaYxi) - [YES24](https://bit.ly/3iGw8Gw) @@ -25,6 +19,10 @@ ★ YouTube: https://www.youtube.com/watch?v=fNyGHpSWhTA +☆ 학교나 학원에서 강의를 진행하시는 교수님/강사님께 제공 가능한 이 책의 강의 교안 자료가 준비되어 있습니다. (1) 성함, 연락처 (2) 강의처 (3) 강의 교과목 (4) 간단한 강의계획 등을 정리하셔서 support@onlybook.co.kr 이메일로 보내주십시오. 내용 검토 후 제공해드리겠습니다. + +★ 참고: 《자바 알고리즘 인터뷰 with 코틀린》 https://github.com/onlybooks/java-algorithm-interview + ![마인드맵](https://user-images.githubusercontent.com/1250095/86745916-a62e9a00-c075-11ea-9aa5-8455e2527f87.png) ## 문제 풀이 @@ -39,7 +37,7 @@ | 7 | [두 수의 합](https://leetcode.com/problems/two-sum/) | ★ | 7장. 배열 | [7-1.py](3-linear-data-structures/ch07/7-1.py)
[7-2.py](3-linear-data-structures/ch07/7-2.py)
[7-3.py](3-linear-data-structures/ch07/7-3.py)
[7-4.py](3-linear-data-structures/ch07/7-4.py)
[7-5.py](3-linear-data-structures/ch07/7-5.py)
[7-6.go](3-linear-data-structures/ch07/7-6.go) | | 8 | [빗물 트래핑](https://leetcode.com/problems/trapping-rain-water/) | ★★★ | 7장. 배열 | [8-1.py](3-linear-data-structures/ch07/8-1.py)
[8-2.py](3-linear-data-structures/ch07/8-2.py) | | 9 | [세 수의 합](https://leetcode.com/problems/3sum/) | ★★ | 7장. 배열 | [9-1.py](3-linear-data-structures/ch07/9-1.py)
[9-2.py](3-linear-data-structures/ch07/9-2.py) | -| 10 | [배열 파티션 I](https://leetcode.com/problems/array-partition-i/) | ★ | 7장. 배열 | [10-1.py](3-linear-data-structures/ch07/10-1.py)
[10-2.py](3-linear-data-structures/ch07/10-2.py)
[10-3.py](3-linear-data-structures/ch07/10-3.py) | +| 10 | [배열 파티션 I](https://leetcode.com/problems/array-partition/) | ★ | 7장. 배열 | [10-1.py](3-linear-data-structures/ch07/10-1.py)
[10-2.py](3-linear-data-structures/ch07/10-2.py)
[10-3.py](3-linear-data-structures/ch07/10-3.py) | | 11 | [자신을 제외한 배열의 곱](https://leetcode.com/problems/product-of-array-except-self/) | ★★ | 7장. 배열 | [11-1.py](3-linear-data-structures/ch07/11-1.py) | | 12 | [주식을 사고팔기 가장 좋은 시점](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/) | ★ | 7장. 배열 | [12-1.py](3-linear-data-structures/ch07/12-1.py)
[12-2.py](3-linear-data-structures/ch07/12-2.py) | | 13 | [팰린드롬 연결 리스트](https://leetcode.com/problems/palindrome-linked-list/) | ★ | 8장. 연결 리스트 | [13-1.py](3-linear-data-structures/ch08/13-1.py)
[13-2.py](3-linear-data-structures/ch08/13-2.py)
[13-3.go](3-linear-data-structures/ch08/13-3.go)
[13-4.py](3-linear-data-structures/ch08/13-4.py) | @@ -138,8 +136,12 @@ - 21장 [분할 가능 배낭 문제](miscellaneous/21-fractional-knapsack.py) - 23장 [0-1 배낭 문제](miscellaneous/23-zero-one-knapsack.py) -## 리트코드 변경 사항 +## 리트코드 변경 사항 및 보다 효율적인 풀이 - 7번 문제는 테스트케이스가 삭제되어 실행 시간이 달라졌습니다. [#62](https://github.com/onlybooks/algorithm-interview/issues/62) +- 25번 문제의 보다 효율적인 풀이는 [#105](https://github.com/onlybooks/algorithm-interview/issues/105)를 참고하세요. - 33번 문제의 보다 효율적인 풀이는 [#91](https://github.com/onlybooks/algorithm-interview/issues/91)을 참고하세요. +- 35번 문제의 보다 효율적인 풀이는 [#111](https://github.com/onlybooks/algorithm-interview/issues/111)을 참고하세요. +- 36번 문제의 보다 효율적인 풀이는 [#112](https://github.com/onlybooks/algorithm-interview/issues/112)를 참고하세요. +- 41번 문제가 테스트케이스 변경으로 타임아웃이 발생하여 더 이상 풀이가 되지 않습니다. [#104](https://github.com/onlybooks/algorithm-interview/issues/104) - 47번 문제는 평가 함수의 변경으로 `TreeNode` 선언을 주석으로 처리하고 실행하세요. [#97](https://github.com/onlybooks/algorithm-interview/issues/97) - 75번 문제는 테스트케이스가 추가되어 더 이상 풀이가 되지 않습니다. 새로운 풀이는 [#67](https://github.com/onlybooks/algorithm-interview/issues/67)을 참고하세요.