1 class Solution:
 2     def missingNumber(self, arr: 'List[int]') -> int:
 3         n = len(arr)
 4         common = (arr[n-1] - arr[0]) // n
 5         if common == 0:
 6             return 0
 7         for i in range(n):
 8             need = arr[0] + common * i
 9             if arr[i] != need:
10                 return need

 

posted on 2019-10-21 00:07  Sempron2800+  阅读(201)  评论(0编辑  收藏  举报