题解 | #合并两个有序的数组#
合并两个有序的数组
https://www.nowcoder.com/practice/89865d4375634fc484f3a24b7fe65665
# # # @param A int整型一维数组 # @param B int整型一维数组 # @return void # class Solution: def merge(self , A, m, B, n): # write code here j = 0 while j < n: b = B[j] i=0 while b > A[i] and i+1<m+n: if i>=m+j: A[i] = b break i+=1 A[i+1:m+j+1] = A[i:m+j] A[i] = b j+=1 return A