Skip to content

Commit c9105de

Browse files
authored
Create 10035-maximum-area-of-longest-diagonal-rectangle.js
1 parent 534ab44 commit c9105de

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* @param {number[][]} dimensions
3+
* @return {number}
4+
*/
5+
var areaOfMaxDiagonal = function(dimensions) {
6+
let res = 0
7+
const n = dimensions
8+
const arr = dimensions.map(([l,w]) => [l ** 2 + w ** 2, l * w])
9+
arr.sort((a, b) => a[0] === b[0] ? b[1] - a[1] : b[0] - a[0])
10+
return arr[0][1]
11+
};

0 commit comments

Comments
 (0)