Python...


  • 1
    def imageSmoother(self, M):
        def smoothed(j):
            sources = sum((row[j-(j>0):j+2] for row in M[i-(i>0):i+2]), [])
            return sum(sources) // len(sources)
        return [map(smoothed, range(len(M[i]))) for i in range(len(M))]

Log in to reply
 

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