LeetCode solutions

1496. Lucky Numbers in a Matrix

My accepted Python solution to LeetCode problem 1496, Lucky Numbers in a Matrix, running in 0ms.

  • Difficulty: Easy
  • Python
  • Runtime 0ms
  • Memory 17.7MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 0ms, memory 17.7MB, accepted 2025-12-30.

python
class Solution:
    def luckyNumbers(self, matrix: List[List[int]]) -> List[int]:
        row_mins = {min(row) for row in matrix}
        col_maxs = {max(col) for col in zip(*matrix)}
        return list(row_mins & col_maxs)

Source