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