Skip to content

Commit bdf50e3

Browse files
committed
Time: 117 ms (31.10%), Space: 17 MB (15.89%) - LeetHub
1 parent fbe166e commit bdf50e3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# time complexity: O(n*m)
2+
# space complexity: O(n+m)
3+
from typing import List
4+
5+
6+
class Solution:
7+
def luckyNumbers(self, matrix: List[List[int]]) -> List[int]:
8+
rowMin = {min(row) for row in matrix}
9+
colMax = {max(col) for col in zip(*matrix)}
10+
11+
return list(rowMin & colMax)
12+
13+
14+
matrix = [[3, 7, 8], [9, 11, 13], [15, 16, 17]]
15+
print(Solution().luckyNumbers(matrix))

0 commit comments

Comments
 (0)