Java 代码
class Solution
{
public List<Integer> getLeastNumbers_Solution(int [] input, int k)
{
Arrays.sort(input, 0, input.length);
List<Integer> result = new ArrayList<Integer>();
for (int i = 0; i < k; i ++)
result.add(input[i]);
return result;
}
}