일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Decorator
- 315. Count of Smaller Numbers After Self
- 43. Multiply Strings
- DWG
- Generator
- 109. Convert Sorted List to Binary Search Tree
- 시바견
- Python
- 밴픽
- Python Code
- Class
- Regular Expression
- 컴퓨터의 구조
- iterator
- Python Implementation
- Convert Sorted List to Binary Search Tree
- concurrency
- 30. Substring with Concatenation of All Words
- Substring with Concatenation of All Words
- Protocol
- 프로그래머스
- attribute
- shiba
- 운영체제
- data science
- kaggle
- LeetCode
- t1
- 715. Range Module
- 파이썬
Archives
- Today
- Total
목록89. Gray Code (1)
Scribbling
LeetCode: 89. Gray Code
n = 0 n = 1 n=2 n = 3 000 001 101 1100 100 1101 1001 1000 e.g. n=3 -> 100 + 1000, 101 + 1000, 001 + 1000, 000 + 1000 -> 역순 + 2의 n-1승 class Solution: def grayCode(self, n: int) -> List[int]: ret = [0] for i in range(n): ret += [x + pow(2, i) for x in reversed(ret)] return ret
Computer Science/Coding Test
2021. 10. 8. 15:21