function countGoodRectangles(rectangles: number[][]): number { const squares = rectangles.map(a => Math.min(...a)) const maxLen = Math.max(...squares) const sameLen = squares.filter(len => len === maxLen) return sameLen.length };