Simple Python3 Solution


  • 0
    Y
    class Solution:
        def maxDistance(self, arrays):
            res = -9999999
            minn = min(arrays[0])
            maxx = max(arrays[0])
            for i in range(1,len(arrays)):
                mina = min(arrays[i])
                maxa = max(arrays[i])
                res = max( res, max(maxa - minn, maxx - mina) )
                minn = min(mina, minn)
                maxx = max(maxa, maxx)
            return res
    ```

Log in to reply
 

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