11. 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. Note: You may not slant the container and n is at least 2. 给了n个非负整数a1, a2, ..., an,每个数代表了一个在笛卡尔坐标的点 (i, ai).n条垂直的线画出来使得线i的两个端点在(i, ai)和 (i, 0)。 找出两条线,使得这两条线跟x轴组成一个容器,使得这个容器能容纳最多的水。 注意:你不能倾斜这个容器并且n至少是2.
你需要完成以下的函数: int maxArea(int* height, int heightSize) { }
这道题的网址是:“https://leetcode.com/problems/container-with-most-water/#/description”
|