deno.land / x / masx200_leetcode_test@10.6.5 / container-with-most-water / index.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function maxArea(height: number[]): number { let l = 0; let r = height.length - 1; let ans = 0; while (l < r) { const area = Math.min(height[l], height[r]) * (r - l); ans = Math.max(ans, area); if (height[l] < height[r]) { l++; } else { r--; } } return ans;}export default maxArea;
masx200_leetcode_test

Version Info

Tagged at
a year ago