题解 | #输入n个整数,输出其中最小的k个#
输入n个整数,输出其中最小的k个
https://www.nowcoder.com/practice/69ef2267aafd4d52b250a272fd27052c
const rl = require("readline").createInterface({ input: process.stdin }); var iter = rl[Symbol.asyncIterator](); const readline = async () => (await iter.next()).value; void (async function () { // Write your code here let arr = []; while ((line = await readline())) { arr.push(line); if (arr.length == 2) { let list = arr[1].split(" ").sort((a, b) => a - b); // console.log(arr[0].split(' ')[1]); console.log(list.slice(0, arr[0].split(' ')[1]).join(' ')); } } })();