일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- DWG
- 715. Range Module
- 밴픽
- Class
- 프로그래머스
- Generator
- 109. Convert Sorted List to Binary Search Tree
- 컴퓨터의 구조
- Python Implementation
- LeetCode
- 운영체제
- 시바견
- Protocol
- shiba
- 30. Substring with Concatenation of All Words
- Python
- data science
- 315. Count of Smaller Numbers After Self
- 파이썬
- kaggle
- Python Code
- Substring with Concatenation of All Words
- attribute
- Regular Expression
- Convert Sorted List to Binary Search Tree
- concurrency
- iterator
- 43. Multiply Strings
- t1
- Decorator
Archives
- Today
- Total
목록341. 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