Skip to content

Conversation

fireairforce
Copy link
Contributor

No description provided.

@fireairforce
Copy link
Contributor Author

这个题目h数组的表示写错了= =

@azl397985856
Copy link
Owner

为啥多个0( why leading zero?)

@fireairforce
Copy link
Contributor Author

因为按照暴力法,这个h数组计算的是Math.min(左侧最高,右侧最高),原数组是[0,1,0,2,1,0,1,3,2,1,2,1],所以第一个值计算出来是0

@fireairforce
Copy link
Contributor Author

h数组的值本来就应该是12个,因为结果是sum += (h[i]-height[i]).每个高度都会对应一个h数组的值

@fireairforce
Copy link
Contributor Author

我重新更新了一下原文的顺序,可能这样比较好理解一点...

@azl397985856
Copy link
Owner

ok 明白了(i see)

@azl397985856 azl397985856 merged commit 23f48f8 into azl397985856:master Jan 27, 2020
baicaihenxiao pushed a commit to baicaihenxiao/leetcode-frontend that referenced this pull request Apr 14, 2020
* fix:修复547题代码变量返回错误的bug

* fix:修复547变量名错误

* fix: azl397985856#42 fix typo

* Update 42.trapping-rain-water.md
azl397985856 pushed a commit that referenced this pull request Aug 19, 2023
* fix:修复547题代码变量返回错误的bug

* fix:修复547变量名错误

* fix: #42 fix typo

* Update 42.trapping-rain-water.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants