两个有序列表,l1,l2,对这两个列表进行合并不可使用extend

本文阅读 0 分钟
首页 › Python笔记 › 正文
def loop_merge_sort(l1,l2):
    tmp = []
    while len(l1)>0 and len(l2)>0:
        if l1[0] <l2[0]:
            tmp.append(l1[0])
            del l1[0]
        else:
            tmp.append(l2[0])
            del l2[0]
    while len(l1)>0:
        tmp.append(l1[0])
        del l1[0]
    while len(l2)>0:
        tmp.append(l2[0])
        del l2[0]
    return tmp
输入某年某月某日,判断这一天是这一年的第几天?
« 上一篇 01-31
给定一个任意长度数组,实现一个函数
下一篇 » 01-31

发表评论