1228. Missing Number In Arithmetic Progression
On This Page
class Solution:
def missingNumber(self, arr: List[int]) -> int:
n = len(arr)
d = (arr[-1] - arr[0]) // n
for i in range(1, n):
if arr[i] != arr[i - 1] + d:
return arr[i - 1] + d
return arr[0]