[프로그래머스 | 자바스크립트] 외계어 사전
프로그래머스(Javascript)/Level 0
2023. 3. 3. 16:35
솔루션 const solution = (spell, dic) => { const sort = (str) => [...str].sort((a, b) => (a sort(dic) === sort(spell.join(""))) ? 1 : 2; console.log(answer); return answer; }; solution(["p", "o", "s"], ["sod", "eocd", "qixm", "adio", "soo"]); solution(["z", "d", "x"], ["def", "dww", "dzx", "loveaw"]); solution(["s", "o", "m", "d..