I write the following code but get the wrong answer.

[1],[2]

expectd: [1,2]

wrong:[1,0]

But the code run fine in my linux enviroment. What is mistaken?

```
def findInsert(self,A,begin,end,mB):
if end>=begin:
middle=(begin+end)/2
if A[middle]==mB:
return middle
elif A[middle]<mB:
begin=middle+1
return self.findInsert(A,begin,end,mB)
else:
end=middle-1
return self.findInsert(A,begin,end,mB)
else:
return begin
def merge(self, A, m, B, n):
if m==0 and n==0:
return
if m==0 or n==0:
j=0
for i in range(m,m+n):
A[i]=B[j]
j=j+1
return
begin=0
end=m-1
for i in range(0,n):
indexA=self.findInsert(A,begin,end,B[i])
if indexA==end+1:
while i<n:
A.append(B[i])
i=i+1
return
else:
A.insert(indexA,B[i])
begin=indexA+1
end=end+1
```