Skip to content

Commit aea5d07

Browse files
add 1725
1 parent 3d746d6 commit aea5d07

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|-----|----------------|---------------|--------|-------------|-------------
11+
|1725|[Number Of Rectangles That Can Form The Largest Square](https://leetcode.com/problems/number-of-rectangles-that-can-form-the-largest-square/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1725.java) ||Easy|Greedy|
1112
|1721|[Swapping Nodes in a Linked List](https://leetcode.com/problems/swapping-nodes-in-a-linked-list/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1721.java) ||Medium|LinkedList|
1213
|1720|[Decode XORed Array](https://leetcode.com/problems/decode-xored-array/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1720.java) ||Easy|Bit Manipulation|
1314
|1718|[Construct the Lexicographically Largest Valid Sequence](https://leetcode.com/problems/construct-the-lexicographically-largest-valid-sequence/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1718.java) ||Medium|Backtracking, Recursion|
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.fishercoder.solutions;
2+
3+
import java.util.TreeMap;
4+
5+
public class _1725 {
6+
public static class Solution1 {
7+
public int countGoodRectangles(int[][] rectangles) {
8+
TreeMap<Integer, Integer> map = new TreeMap<>();
9+
for (int[] rec : rectangles) {
10+
int min = Math.min(rec[0], rec[1]);
11+
map.put(min, map.getOrDefault(min, 0) + 1);
12+
}
13+
return map.lastEntry().getValue();
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)