mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-25 12:14:26 +08:00
规范格式
This commit is contained in:
@ -0,0 +1,22 @@
|
||||
package leetcode
|
||||
|
||||
func maxArea(height []int) int {
|
||||
max, start, end := 0, 0, len(height)-1
|
||||
for start < end {
|
||||
width := end - start
|
||||
high := 0
|
||||
if height[start] < height[end] {
|
||||
high = height[start]
|
||||
start++
|
||||
} else {
|
||||
high = height[end]
|
||||
end--
|
||||
}
|
||||
|
||||
temp := width * high
|
||||
if temp > max {
|
||||
max = temp
|
||||
}
|
||||
}
|
||||
return max
|
||||
}
|
Reference in New Issue
Block a user