You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This discussion was converted from issue #10 on September 15, 2026 10:57.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Problem link
https://leetcode.com/problems/trapping-rain-water/
Problem Summary
지도의 높이가 주어지고 비가 왔을 때 얼마나 찰 수 있는지 출력하는 문제.
Solution
물이 어떨 때 차는지 잘 살펴보면 된다.
물이 차는 높이는 현재 기준으로 왼쪽의 최대, 오른쪽의 최대 중 최솟값만큼 채워진다.
그렇다면 왼쪽의 최대, 오른쪽의 최대를 구하면 되는데 필요할 때마다 구하면 시간 초과가 되므로 미리 구해놓으면 된다.
Source Code
All reactions