mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-06 17:44:10 +08:00
Update 807 solution
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
# [807. Max Increase to Keep City Skyline](https://leetcode-cn.com/problems/max-increase-to-keep-city-skyline/)
|
||||
# [807. Max Increase to Keep City Skyline](https://leetcode.com/problems/max-increase-to-keep-city-skyline/)
|
||||
|
||||
## 题目
|
||||
|
||||
@ -47,10 +47,10 @@ Return the maximum total sum that the height of the buildings can be increased b
|
||||
|
||||
## 解题思路
|
||||
|
||||
- 从数组竖直方向(即顶部,底部)看“天际线”计算出topBottomSkyline
|
||||
- 从数组水平方向(即左侧,右侧)看“天际线”计算出leftRightSkyline
|
||||
- 计算grid中每个元素与对应的topBottomSkyline和leftRightSkyline中较小值的差值
|
||||
- 统计所有差值的总和ans并返回
|
||||
- 从数组竖直方向(即顶部,底部)看“天际线”计算出 topBottomSkyline
|
||||
- 从数组水平方向(即左侧,右侧)看“天际线”计算出 leftRightSkyline
|
||||
- 计算 grid 中每个元素与对应的 topBottomSkyline 和 leftRightSkyline 中较小值的差值
|
||||
- 统计所有差值的总和 ans 并返回
|
||||
|
||||
## 代码
|
||||
|
||||
|
Reference in New Issue
Block a user