题解 | #合并两个有序的数组#
合并两个有序的数组
http://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 Am = m An = n while(m-1>=0 and n-1>=0): if(A[m-1]>=B[n-1]): A[m+n-1] = A[m-1] m = m-1 else: A[m+n-1] = B[n-1] n = n-1 if n>=1: A[m:m+n] = B[:n] return A