Python very easy solution


  • 1
    I
    class Solution(object):
        def missingNumber(self, nums):
            """
            :type nums: List[int]
            :rtype: int
            """
            size = len(nums)
            return ( (size * (size + 1)) / 2 ) - sum(nums)
    

Log in to reply
 

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