Leetcode 2086: Minimum Number of Buckets Required to Collect Rainwater from Houses
2 min readNov 30, 2021
--
In this problem, we are given a String representing a street with houses and empty spaces. To collect water from the houses, each house must have a bucket placed next to it. We need to return the minimum amount of buckets to do that.
You are given a 0-indexed string
street
. Each character instreet
is either'H'
representing a house or'.'
representing an empty space.You can place buckets on the empty spaces to collect rainwater that falls from the adjacent houses…