1439. Find the Kth Smallest Sum of a Matrix With Sorted Rows (Hard) - TengnanYao/daily_leetcode GitHub Wiki
class Solution(object):
def kthSmallest(self, mat, k):
"""
:type mat: List[List[int]]
:type k: int
:rtype: int
"""
result = [0]
for row in mat:
result = [x + y for x in result for y in row]
result.sort()
result = result[ : k]
return result[-1]