[LintCode] Container With Most Water 装最多水的容器

Posted Grandyang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[LintCode] Container With Most Water 装最多水的容器相关的知识,希望对你有一定的参考价值。

 

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.

 Notice

You may not slant the container.

Example

Given [1,3,2], the max area of the container is 2.

 

s

 

 

以上是关于[LintCode] Container With Most Water 装最多水的容器的主要内容,如果未能解决你的问题,请参考以下文章

lintcode597- Subtree with Maximum Average- easy

[LintCode] 597. Subtree with Maximum Average

Lintcode105.Copy List with Random Pointer

lintcode-easy-Convert Sorted Array to Binary Search Tree with Minimal Height

lintcode105- Copy List with Random Pointer- medium

Lintcode]177.Convert Sorted Array to Binary Search Tree With Minimal Height