Skip to content

Instantly share code, notes, and snippets.

@NhanKhangg98
Created October 22, 2022 10:08
Show Gist options
  • Save NhanKhangg98/0460683ba5af6c9ca53e83a4ed628d66 to your computer and use it in GitHub Desktop.
Save NhanKhangg98/0460683ba5af6c9ca53e83a4ed628d66 to your computer and use it in GitHub Desktop.
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