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