10.Container With Most Water Leetcode Python
来源:互联网 发布:淘宝卖家怎么做直播 编辑:程序博客网 时间:2024/06/05 10:38
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a container, such that the container contains the most water.
Note: You may not slant the container.
这道题依次往左边和右边搜索,当左边比右边小的时候 左边加一 否则右边减一 直到搜索结束。
class Solution: # @return an integer def maxArea(self, height): left=0 right=len(height)-1 area=0 while left!=right: water=min(height[left],height[right])*(right-left) area=max(area,water) if height[left]<height[right]: left+=1 else: right-=1 return area
0 0
- 10.Container With Most Water Leetcode Python
- 【LeetCode with Python】 Container With Most Water
- Leetcode -- Python --Container With Most Water
- 【LeetCode】【Python题解】Container with most water
- 【LEETCODE】11-Container With Most Water [Python]
- 【leetcode】Container with most water--python实现
- Container With Most Water Leetcode Python Java
- [Leetcode] Container With Most Water Python
- [leetcode: Python]11. Container With Most Water
- 【Leetcode】【python】Container With Most Water
- LeetCode: Container With Most Water
- [LeetCode]Container With Most Water
- LeetCode Container With Most Water
- LeetCode: Container With Most Water
- [Leetcode] Container With Most Water
- Leetcode: Container With Most Water
- [LeetCode] Container With Most Water
- LeetCode Container With Most Water
- 陶瓷企业如何用好电子商务这把刀助力发展
- new 修饰符(msdn C# 参考)
- 电子商务和CRM相辅相成
- 《马云创业语录》——创业者就是要面对困难
- 数据结构之队列
- 10.Container With Most Water Leetcode Python
- 8dVASair max運動鞋台灣哪裡找 2JPf KzI
- 数据结构之AVLTree(04-1:Root of AVL Tree)
- Decode Ways - Leetcode
- poj 1125 最短路
- 基于经济学视角对我国职业教育起源进行探讨
- C#——调用exe程序并运行
- [Leetcode]Linked List Cycle II
- Binary Tree Level Order Traversal II