题目解析
简单的排序题,逻辑请看代码。
JavaScript算法源码
/* JavaScript Node ACM模式 控制台输入获取 */
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
const lines = [];
let n;
rl.on("line", (line) => {
lines.push(line);
if (lines.length === 1) {
n = lines[0] - 0;
}
if (n && lines.length === n + 2) {
lines.shift();
const target = lines.pop();
console.log(getResult(lines, target));
lines.length = 0;
}
});
function getResult(words, target) {
const sorted_target = [...target].sort().join("");
const ans = [];
for (let word of words) {
const sorted_word = [...w
寻找相似单词算法

已下架不支持订阅
7255

被折叠的 条评论
为什么被折叠?



