commit b18549f3fc14b71d6273ecda36cad69f9ce781cb
parent 66342962641aefca68f3742472458b027dda4f5a
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date: Mon, 29 Jul 2024 23:20:11 +0200
1 Random Problem
Diffstat:
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/Problems/2001.cpp b/Problems/2001.cpp
@@ -0,0 +1,13 @@
+class Solution {
+ public:
+ long long interchangeableRectangles(const vector<vector<int>> &rectangles) const {
+ unordered_map<double, int> um;
+ long long res = 0;
+
+ for (const auto &rec : rectangles) {
+ res += um[(double)rec[0] / rec[1]]++;
+ }
+
+ return res;
+ }
+};
diff --git a/README.md b/README.md
@@ -1042,6 +1042,7 @@ for solving problems.
| 1991 | Easy | [Find the Middle Index in Array](Problems/1991.cpp) |
| 1992 | Medium | [Find All Groups of Farmland](Problems/1992.cpp) |
| 2000 | Easy | [Reverse Prefix of Word](Problems/2000.cpp) |
+| 2001 | Medium | [Number of Pairs of Interchangeable Rectangles](Problems/2001.cpp) |
| 2002 | Medium | [Maximum Product of the Length of Two Palindromic Subsequences](Problems/2002.cpp) |
| 2009 | Hard | [Minimum Number of Operations to Make Array Continuous](Problems/2009.cpp) |
| 2023 | Medium | [Number of Pairs of Strings With Concatenation Equal to Target](Problems/2023.cpp) |