1. 思路 没啥可讲的,直接看代码吧 2. 代码 # -*- coding:utf-8 -*- class Solution: def GetLeastNumbers_Solution(self, tinput, k): # write code here if k > len(tinput):return [] results = [] for i in range(k): results.append(min(tinput)) tinput.remove(min(tinput)) return results