HELP What's wrong with my python code THANKS


  • 0
    C
    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):
        result = list()
        i,j = 0,0
        while i < m and j < n:
            if i < m and j < n:
                if A[i] <= B[j]:
                    result.append(A[i])
                    i = i + 1
                else:
                    result.append(B[j])
                    j = j + 1
        result.extend(A[i:])
        result.extend(B[j:])
        A = result

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.