Python short lines solutuion


  • 0
    W
    class Solution(object):
        def missingNumber(self, nums):
            l = range(sorted(nums)[-1]+1)
            if len(nums) != len(l):
                return list(set(l).difference(set(nums)))[0]
            return sorted(nums)[-1] + 1
    

Log in to reply
 

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