Below is my solution for merge of two sorted arrays A,B. I implemented the merge section of merge sort, but for some reason the system does not accept my solution and points it has a wrong answer for input [] [1]. The algorithm return [1] when I run it in my machine. But the system gets an output of [0] for this input. Not sure what is wrong with the code. Any help would be useful. Thanks

```
class Solution:
# @param A a list of integers
# @param m an integer, length of A
# @param B a list of integers
# @param n an integer, length of B
# @return nothing
def merge(self, A, m, B, n):
sorted_array = []
if m>0 and n > 0:
i,j = 0,0
while i < m and j < n:
if A[i] < B[j]:
sorted_array.append(A[i])
i += 1
else:
sorted_array.append(B[j])
j += 1
if j == n:
sorted_array.extend(A[i:])
else:
sorted_array.extend(B[j:])
#assigning back to A
A = sorted_array
elif B:
A = B
return
```