init commit

This commit is contained in:
2024-03-19 01:05:51 +08:00
commit 199bbf2628
393 changed files with 34883 additions and 0 deletions

View File

@ -0,0 +1,23 @@
package main
func maxArea(height []int) int {
var left, right, max = 0, len(height) - 1, 0
for left < right {
area := 0
if height[left] > height[right] {
area = height[right] * (right - left)
right--
} else {
area = height[left] * (right - left)
left++
}
if area > max {
max = area
}
}
return max
}
func main() {
println(maxArea([]int{1, 2, 54, 75, 3, 5, 7, 93, 3}))
}