일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- iterator
- 109. Convert Sorted List to Binary Search Tree
- 컴퓨터의 구조
- Python Code
- t1
- 프로그래머스
- DWG
- Protocol
- 운영체제
- 315. Count of Smaller Numbers After Self
- 30. Substring with Concatenation of All Words
- 715. Range Module
- shiba
- Python Implementation
- Python
- 밴픽
- concurrency
- kaggle
- 파이썬
- data science
- LeetCode
- Regular Expression
- Generator
- Class
- attribute
- Convert Sorted List to Binary Search Tree
- 43. Multiply Strings
- Substring with Concatenation of All Words
Archives
- Today
- Total
목록75. Sort Colors (1)
Scribbling
LeetCode: 75. Sort Colors
We already know that all the elements are in [0, 1, 2]. So, we count each element's frequencies. class Solution: def sortColors(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ count = [0] * 3 for num in nums: count[num] += 1 count[2] = count[1] + count[0] count[1] = count[0] for i in range(count[1]): nums[i] = 0 for i in range(count[1], count[2]): nu..
Computer Science/Coding Test
2021. 9. 28. 21:34