Skip to content

Commit ec0d093

Browse files
committed
Time: 305 ms (13.33%), Space: 13.9 MB (100.00%) - LeetHub
1 parent fe90b4c commit ec0d093

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution {
2+
func countGoodRectangles(_ rectangles: [[Int]]) -> Int {
3+
var maxLen = 0, result = 0
4+
5+
for rectangle in rectangles {
6+
let smallSide = min(rectangle[0], rectangle[1])
7+
8+
if smallSide > maxLen {
9+
maxLen = smallSide
10+
result = 1
11+
} else if smallSide == maxLen {
12+
result += 1
13+
}
14+
}
15+
return result
16+
}
17+
}

0 commit comments

Comments
 (0)