Skip to content

Commit 5a55ade

Browse files
authored
Create 1725-number-of-rectangles-that-can-form-the-largest-square.js
1 parent a02e736 commit 5a55ade

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @param {number[][]} rectangles
3+
* @return {number}
4+
*/
5+
const countGoodRectangles = function(A) {
6+
const arr = []
7+
let max = 0
8+
A.forEach(e => {
9+
const tmp = Math.min(...e)
10+
if(tmp > max) max=tmp
11+
arr.push(tmp)
12+
})
13+
let res = 0
14+
for(let e of arr) {
15+
if(e >= max) res++
16+
}
17+
return res
18+
};

0 commit comments

Comments
 (0)