# -*- coding:utf-8 -*- class Solution: def GetLeastNumbers_Solution(self, tinput, k): # write code here tinput.sort() return tinput[:k]
使用自带的sort()函数
# -*- coding:utf-8 -*- class Solution: def GetLeastNumbers_Solution(self, tinput, k): # write code here tinput.sort() return tinput[:k]
使用自带的sort()函数