python solution beats 99%


  • -1
    P
    class Solution(object):
        def maximumGap(self, nums):
            """
            :type nums: List[int]
            :rtype: int
            """
            nums.sort()
            res=0
            if not nums: return 0
            for i in range(len(nums)-1):
                res=max(res,nums[i+1]-nums[i])
            return res
    
    
    
    

    I don't understand why the difficulty of this problem is hard..😴


  • 0
    C

    @pyufftj no idea why brute force can be accepted


Log in to reply
 

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