2 line Solution for Python


  • -1
    Y
    class Solution(object):
        def missingNumber(self, nums):
            """
            :type nums: List[int]
            :rtype: int
            """
            nums.sort()
            return ((list((set(range(0,max(nums)+1))) - set(nums))[0]) if (len(nums) != (max(nums)+1)) else (max(nums)+1))
    

Log in to reply
 

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