题目:合并两个排序的整数数组A和B变成一个新的数组。
链接:点击打开链接
思路:python超简单,因为自带sort函数,不需要引用模块就可以使用
代码:
class Solution:
"""
@param A: sorted integer array A
@param B: sorted integer array B
@return: A new sorted integer array
"""
def mergeSortedArray(self, A, B):
# write your code here
listA=A
listB=B
for i in listA:
listB.append(i)
listB.sort()
return B