일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 밴픽
- Python
- 시바견
- Python Code
- DWG
- Substring with Concatenation of All Words
- kaggle
- data science
- concurrency
- Class
- 43. Multiply Strings
- LeetCode
- iterator
- Decorator
- Protocol
- Generator
- Regular Expression
- 30. Substring with Concatenation of All Words
- 315. Count of Smaller Numbers After Self
- t1
- shiba
- 운영체제
- Convert Sorted List to Binary Search Tree
- 715. Range Module
- Python Implementation
- attribute
- 프로그래머스
- 컴퓨터의 구조
- 파이썬
- 109. Convert Sorted List to Binary Search Tree
Archives
- Today
- Total
목록42. Trapping Rain Water (1)
Scribbling
LeetCode: 42. Trapping Rain Water
The key observations to solve this problems: - right >= left + 2, to contain water - if we have a max height either at left or right position, then we can calculate water in the opposite position. class Solution: def trap(self, height: List[int]) -> int: ret = 0 l, r = 0, len(height) - 1 leftmax, rightmax = height[l], height[r] while r - l >= 2: curmax = max(leftmax, rightmax) if curmax == right..
Computer Science/Coding Test
2021. 9. 12. 23:20