diff options
Diffstat (limited to 'other/image_overlap.cpp')
-rw-r--r-- | other/image_overlap.cpp | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/other/image_overlap.cpp b/other/image_overlap.cpp deleted file mode 100644 index bc6eeba..0000000 --- a/other/image_overlap.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - int largestOverlap(vvd & img1, vvd & img2) { - vector<int> la, lb; - int n = img1.size(); - unordered_map<int, int> count; - for (int i = 0; i < n * n; ++i) - if (img1[i / n][i % n] == 1) - la.push_back(i / n * 100 + i % n); - for (int i = 0; i < n * n; ++i) - if (img2[i / n][i % n] == 1) - lb.push_back(i / n * 100 + i % n); - for (int i : la) - for (int j : lb) - count[i - j]++; - int ans = 0; - for (auto it : count) - ans = max(ans, it.second); - return ans; - } -}; |