Skip to content

Commit f773a70

Browse files
committed
Runtime: 593 ms (Top 76.00%) | Memory: 14.7 MB (Top 44.00%)
1 parent 730cca2 commit f773a70

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Runtime: 593 ms (Top 76.00%) | Memory: 14.7 MB (Top 44.00%)
12
class Solution:
23
def largestOverlap(self, img1: List[List[int]], img2: List[List[int]]) -> int:
34
n = len(img1)
@@ -8,12 +9,12 @@ def largestOverlap(self, img1: List[List[int]], img2: List[List[int]]) -> int:
89
if img1[r][c]:
910
list1.append((r, c))
1011
if img2[r][c]:
11-
list2.append((r, c))
12-
13-
shiftDict = defaultdict(int)
12+
list2.append((r, c))
13+
14+
shiftDict = defaultdict(int)
1415
for x1, y1 in list1:
1516
for x2, y2 in list2:
1617
dx, dy = x2 - x1, y2 - y1
1718
shiftDict[(dx, dy)] += 1
18-
19-
return max(shiftDict.values()) if shiftDict else 0
19+
20+
return max(shiftDict.values()) if shiftDict else 0

0 commit comments

Comments
 (0)