Leetcode Interview questions 40 The reference codes are as follows
class Solution:
def getLeastNumbers(self, arr: List[int], k: int) -> List[int]:
return list(sorted(arr))[:k]
Topic link :
Power button https://leetcode.cn/problems/zui-xiao-de-kge-shu-lcof