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

Commit6904135

Browse files
add 2001
1 parent975035c commit6904135

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-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+
|2001|[Number of Pairs of Interchangeable Rectangles](https://leetcode.com/problems/number-of-pairs-of-interchangeable-rectangles/)|[Python3](../master/python3/_2001.py)||Medium||
1112
|2000|[Reverse Prefix of Word](https://leetcode.com/problems/reverse-prefix-of-word/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_2000.java)||Easy||
1213
|1996|[The Number of Weak Characters in the Game](https://leetcode.com/problems/the-number-of-weak-characters-in-the-game/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1996.java)||Medium||
1314
|1995|[Count Special Quadruplets](https://leetcode.com/problems/count-special-quadruplets/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1995.java)||Easy||

‎python3/2001.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
fromfractionsimport*
2+
fromcollectionsimportCounter
3+
4+
classSolution:
5+
#credit: https://leetcode-cn.com/u/lucifer1004/
6+
definterchangeableRectangles(self,rectangles:List[List[int]])->int:
7+
cnt=Counter()
8+
forw,hinrectangles:
9+
cnt[Fraction(w,h)]+=1
10+
ans=0
11+
forvalueincnt.values():
12+
ans+=value* (value-1)//2
13+
returnans

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp