Simple Math Calculation


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

Log in to reply
 

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