题解 | #字符串排序#
字符串排序
https://www.nowcoder.com/practice/5af18ba2eb45443aa91a11e848aa6723
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
const inputs = []
while(line = await readline()){
inputs.push(line)
}
const [count, ...strs] = inputs;
for (let i=0;i<strs.length-1;i++) {
for (let j=0;j<strs.length-i-1;j++) {
if (strs[j+1] < strs[j]) {
let temp = strs[j]
strs[j] = strs[j+1]
strs[j+1] = temp
}
}
}
for (const s of strs) {
console.log(s);
}
}()
汤臣倍健公司氛围 388人发布
