#
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
# 找缺失数字
# @param a int整型一维数组 给定的数字串
# @return int整型
#
class Solution:
def solve(self , a ):
# write code here
start = 0
end = len(a) - 1
middle = (start + end)//2
while (end - start) > 1:
if a[middle] > (a[0] + middle):
end = middle
else:
start = middle
middle = (start + end)//2
if((a[end] == (a[0]+end)) & (a[0]!=0)):
return a[0] - 1
elif((a[end] == (a[0]+end)) & (a[0]==0)):
return a[end] + 1
return a[end] -1