HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
🤎
프론트엔드 데브코스 5기 교육생
/
🐥
김은수팀
/
🏆
17주차 : 기업 코테 딱대
/
2. 영단어 암기는 괴로워

2. 영단어 암기는 괴로워

고른사람
민수
URL
https://www.acmicpc.net/problem/20920
난이도
실버3

민수 풀이

재현 풀이

송희 풀이

승민 풀이

const fs = require("fs"); const filePath = process.platform === "linux" ? "/dev/stdin" : "./input.txt"; const [nm, ...words] = fs.readFileSync(filePath).toString().trim().split("\n"); let [n, m] = nm.split(" "); let mLengthUp = []; words.forEach((ele) => { if (ele.length >= +m) mLengthUp.push(ele); }); let alphabetSorted = mLengthUp.sort(); let lengthSorted = alphabetSorted.sort((a, b) => b.length - a.length); let frequency = []; let count = 1; for (i = 0; i < lengthSorted.length; i++) { if (lengthSorted[i] == lengthSorted[i + 1]) count++; else { frequency.push([lengthSorted[i], count]); count = 1; } } let frequencySorted = frequency.sort((a, b) => b[1] - a[1]); let result = []; frequencySorted.forEach((ele) => result.push(ele[0])); console.log(result.join("\n"));