Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaea5d07

Browse files
add 1725
1 parent3d746d6 commitaea5d07

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+
packagecom.fishercoder.solutions;
2+
3+
importjava.util.TreeMap;
4+
5+
publicclass_1725 {
6+
publicstaticclassSolution1 {
7+
publicintcountGoodRectangles(int[][]rectangles) {
8+
TreeMap<Integer,Integer>map =newTreeMap<>();
9+
for (int[]rec :rectangles) {
10+
intmin =Math.min(rec[0],rec[1]);
11+
map.put(min,map.getOrDefault(min,0) +1);
12+
}
13+
returnmap.lastEntry().getValue();
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp