42. Trapping Rain Water
·
Algorithm
Trapping Rain Water - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 0보다 같거나 큰 양의 정수로 이루어진 배열이 주어진다. 주어진 배열을 이용해 해당 index에 value 길이의 벽을 세운다고 가정하고 비가 올 때 최대로 받을 수 있는 빗물의 양을 구하는 문제다. 1. Stack from typing import * class Solution: def trap(self, heights: List[int]) -> int: stack, answ..