| https://leetcode.com/problems/number-of-rectangles-that-can-form-the-largest-square/description/ | Easy |
|---|
class Solution {
fun countGoodRectangles(rectangles: Array<IntArray>): Int {
var maxSide = 0
for ((l, w) in rectangles) {
val side = minOf(l, w)
if (side > maxSide) maxSide = side
}
var count = 0
for ((l, w) in rectangles) {
if (minOf(l, w) == maxSide) count++
}
return count
}
}