Skip to content

Commit 340ac1a

Browse files
committed
Time: 152 ms (18.83%), Space: 22.1 MB (35%) - LeetHub
1 parent 2bdbd92 commit 340ac1a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution:
2+
def equalPairs(self, grid: List[List[int]]) -> int:
3+
n = len(grid[0])
4+
cnt = 0
5+
6+
grid_rev = []
7+
for i in range(n):
8+
a = []
9+
for j in range(n):
10+
a.append(grid[j][i])
11+
grid_rev.append(a)
12+
13+
for i in grid:
14+
for j in grid_rev:
15+
if i == j:
16+
cnt += 1
17+
return cnt

0 commit comments

Comments
 (0)