Could this be a lazy solution ? 23333333


  • 0
    R

    just like this. append every element into a list and then sort it.

    class Solution(object):
        def kthSmallest(self, matrix, k):
            """
            :type matrix: List[List[int]]
            :type k: int
            :rtype: int
            """
            ans=[]
            for i in matrix:
                ans.extend(i)
            ans=sorted(ans)
            return ans[k-1]
    

Log in to reply
 

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