Python一行。。溜了溜了
最小的K个数
http://www.nowcoder.com/questionTerminal/6a296eb82cf844ca8539b57c23e6e9bf
-- coding:utf-8 --
class Solution:
def GetLeastNumbers_Solution(self, tinput, k):
return [] if k>len(tinput) else sorted(tinput)[:k]
最小的K个数
http://www.nowcoder.com/questionTerminal/6a296eb82cf844ca8539b57c23e6e9bf
class Solution:
def GetLeastNumbers_Solution(self, tinput, k):
return [] if k>len(tinput) else sorted(tinput)[:k]
相关推荐