Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- string
- DP
- 재귀
- HashTable
- two pointers
- dfs
- math
- binary search
- Binary
- leetcode
- 미디움
- 이진트리
- Python
- list
- backtracking
- binary tree
- Depth-first Search
- tree
- recursive
- 문자열
- matrix
- hash table
- sorting
- Array
- 리트코드
- 쉬움
- Medium
- 중간
- linked list
- easy
Archives
- Today
- Total
목록2024/03/29 (1)
부부의 코딩 성장 일기
LeetCode 143(Reorder List, Python)
1. 문제 링크 https://leetcode.com/problems/reorder-list/ 2. 문제 설명 linked list의 head가 주어졌을 때, 해당 list를 아래처럼 표현할 수 있다. L0 → L1 → ... → Ln-1 → Ln 이 때, 아래의 형태가 되도록 list를 reorder해라. L0 → Ln → L1 → Ln-1 → L2 → Ln-2 → ... 여기서 node의 value자체를 수정하는 것이 아니라, node의 연결관계를 바꿔야 한다. 예시1) head가 [1,2,3,4]로 1→2→3→4의 연결관계를 가지고 있다면, 1→4→2→3으로 변경할 수 있다. output = [1,4,2,3] 예시2) head가 [1,2,3,4,5]로 1→2→3→4→5의 연결관계를 가지고 있다면, ..
Algorithm/LeetCode
2024. 3. 29. 19:00