일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 715. Range Module
- 파이썬
- 운영체제
- 315. Count of Smaller Numbers After Self
- Convert Sorted List to Binary Search Tree
- data science
- attribute
- 컴퓨터의 구조
- Decorator
- Generator
- 30. Substring with Concatenation of All Words
- 밴픽
- Substring with Concatenation of All Words
- Python
- 109. Convert Sorted List to Binary Search Tree
- t1
- Class
- 시바견
- 43. Multiply Strings
- Python Code
- Python Implementation
- 프로그래머스
- Protocol
- LeetCode
- iterator
- Regular Expression
- concurrency
- shiba
- DWG
- kaggle
Archives
- Today
- Total
목록candy (1)
Scribbling
LeetCode: 135. Candy
Key idea: one's number of candies is affected by all the left and right neighbors. So we iterate the list twice, forward and backward. class Solution: def candy(self, ratings: List[int]) -> int: n = len(ratings) candies = [1] * n # forward pass for i in range(1, n): if ratings[i] > ratings[i-1]: candies[i] = candies[i-1] + 1 # backward pass for i in range(n-2, -1, -1): if ratings[i] > ratings[i+..
Computer Science/Coding Test
2022. 2. 3. 10:35