일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Class
- Regular Expression
- 프로그래머스
- 43. Multiply Strings
- Convert Sorted List to Binary Search Tree
- LeetCode
- 컴퓨터의 구조
- 밴픽
- DWG
- Python
- t1
- Decorator
- Protocol
- Python Implementation
- shiba
- Generator
- concurrency
- iterator
- 30. Substring with Concatenation of All Words
- Substring with Concatenation of All Words
- 715. Range Module
- 109. Convert Sorted List to Binary Search Tree
- 파이썬
- attribute
- data science
- 운영체제
- Python Code
- kaggle
- 315. Count of Smaller Numbers After Self
- 시바견
Archives
- Today
- Total
목록Flatten Nested List Iterator (1)
Scribbling
LeetCode: 341. Flatten Nested List Iterator
Making a new list is an easy solution to implement with recursion. class NestedIterator: def __init__(self, nestedList: [NestedInteger]): self.res = [] self._flattener(nestedList) self.ptr = 0 def _flattener(self, nestedList): for nl in nestedList: if nl.isInteger(): self.res.append(nl.getInteger()) else: self._flattener(nl.getList()) def next(self) -> int: ret = self.res[self.ptr] self.ptr += 1..
Computer Science/Coding Test
2022. 1. 13. 14:43