My simple python solution


  • 0
    A
    def kthSmallest(self, matrix, k):
            ans = []
            for item in matrix:
                ans.extend(item[:k])
                ans = sorted(ans)[:k]
            return ans[k-1]
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.