일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 715. Range Module
- 시바견
- 밴픽
- shiba
- attribute
- 컴퓨터의 구조
- Convert Sorted List to Binary Search Tree
- Substring with Concatenation of All Words
- 운영체제
- Python Implementation
- Decorator
- Class
- Python Code
- t1
- Regular Expression
- 109. Convert Sorted List to Binary Search Tree
- 315. Count of Smaller Numbers After Self
- iterator
- DWG
- data science
- kaggle
- 30. Substring with Concatenation of All Words
- LeetCode
- Python
- 43. Multiply Strings
- 파이썬
- Generator
- Protocol
- concurrency
- 프로그래머스
Archives
- Today
- Total
목록138. Copy List with Random Pointer (1)
Scribbling
LeetCode: 138. Copy List with Random Pointer
O(N) Time, O(N) Memory """ # Definition for a Node. class Node: def __init__(self, x: int, next: 'Node' = None, random: 'Node' = None): self.val = int(x) self.next = next self.random = random """ class Solution: def copyRandomList(self, head: 'Node') -> 'Node': if not head: return cur, dic = head, {} while cur: dic[cur] = Node(x=cur.val) cur = cur.next cur = head while cur: if cur.next: dic[cur]..
Computer Science/Coding Test
2021. 11. 16. 21:44