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