力扣:11盛水最多的容器
生活随笔
收集整理的這篇文章主要介紹了
力扣:11盛水最多的容器
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
class Solution:def maxArea(self, height: List[int]) -> int:i, j, res = 0, len(height) - 1, 0while i < j:if height[i] < height[j]:res = max(res, height[i] * (j - i))i += 1else:res = max(res, height[j] * (j - i))j -= 1return res
總結(jié)
以上是生活随笔為你收集整理的力扣:11盛水最多的容器的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 寻找一个字符串中所有重复字符的索引
- 下一篇: 力扣:15三数之和(python)