What's wrong with this code.....i run this code to geeksforgeeks ide it will give correct answer


#1
    list1=[]
    m=len(A)
    n=len(B)
    i=0
    j=0
    
    while(m>i and n>j):
        if (A[i]<=B[j]):
            list1.append(A[i])
            i+=1 
        else:
            list1.append(B[j])
            j+=1
            
    while(n>j):
        list1.append(B[j])
        j+=1 
    
    while (m>i):
        list1.append(A[i])
        i+=1 
    
    #print(list1)
    length=len(list1)
    if length%2!=0:
        median=(length+1)//2
        median=median-1 
        return list1[median]

    else:
        t1=length//2
        total1=list1[t1-1]
        t2=(length+2)//2
        total2=list1[t2-1]
        
        total=(total1+total2)/2
        #median=((length/2)+((length+2)/2))/2
        #median=median-1 
        return total

#2

As the problem states you have to write a solution that take O(log(m+n)). Your current solution takes O(m)+O(n) .