<filename>Python3/1337-The-K-Weakest-Rows-in-a-Matrix/soln.py
class Solution:
    def kWeakestRows(self, mat: List[List[int]], k: int) -> List[int]:
        ones = [sum(row) for row in mat]
        return heapq.nsmallest(k, range(len(mat)), key=lambda x : (ones[x], x))

<filename>Python3/1337-The-K-Weakest-Rows-in-a-Matrix/soln.py
class Solution:
    def kWeakestRows(self, mat: List[List[int]], k: int) -> List[int]:
        ones = [sum(row) for row in mat]
        return heapq.nsmallest(k, range(len(mat)), key=lambda x : (ones[x], x))
