Created
October 22, 2022 10:08
-
-
Save NhanKhangg98/0460683ba5af6c9ca53e83a4ed628d66 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var maxArea = function(height: number[]) { | |
| let maxArea = 0; | |
| for (let i = 0; i < height.length; i++) { | |
| for (let j = i+1; j < height.length; j++) { | |
| let h = Math.min(height[i], height[j]); | |
| let w = j - i; | |
| let area = h * w; | |
| maxArea = Math.max(area, maxArea); | |
| } | |
| } | |
| return maxArea; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment