|
71 | 71 | JavaScript Code: |
72 | 72 |
|
73 | 73 | ```js |
74 | | -/* |
75 | | - * @lc app=leetcode id=11 lang=javascript |
76 | | - * |
77 | | - * [11] Container With Most Water |
78 | | - * |
79 | | - * https://leetcode.com/problems/container-with-most-water/description/ |
80 | | - * |
81 | | - * algorithms |
82 | | - * Medium (42.86%) |
83 | | - * Total Accepted: 344.3K |
84 | | - * Total Submissions: 790.1K |
85 | | - * Testcase Example: '[1,8,6,2,5,4,8,3,7]' |
86 | | - * |
87 | | - * Given n non-negative integers a1, a2, ..., an , where each represents a |
88 | | - * point at coordinate (i, ai). n vertical lines are drawn such that the two |
89 | | - * endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together |
90 | | - * with x-axis forms a container, such that the container contains the most |
91 | | - * water. |
92 | | - * |
93 | | - * Note: You may not slant the container and n is at least 2. |
94 | | - * |
95 | | - * |
96 | | - * |
97 | | - * |
98 | | - * |
99 | | - * The above vertical lines are represented by array [1,8,6,2,5,4,8,3,7]. In |
100 | | - * this case, the max area of water (blue section) the container can contain is |
101 | | - * 49. |
102 | | - * |
103 | | - * |
104 | | - * |
105 | | - * Example: |
106 | | - * |
107 | | - * |
108 | | - * Input: [1,8,6,2,5,4,8,3,7] |
109 | | - * Output: 49 |
110 | | - * |
111 | | - */ |
112 | 74 | /** |
113 | 75 | * @param {number[]} height |
114 | 76 | * @return {number} |
|
0 commit comments