프로그래머스 3차 압축

    [프로그래머스] 압축 - 자바스크립트

    문제 코딩테스트 연습 - [3차] 압축 TOBEORNOTTOBEORTOBEORNOT [20, 15, 2, 5, 15, 18, 14, 15, 20, 27, 29, 31, 36, 30, 32, 34] programmers.co.kr 코드 function solution(msg) { const answer = []; const dict = [0]; for (let i = 0; i < 26; i++) { dict.push(String.fromCharCode(i + 65)); } let idx = 0; let w = msg[idx]; while (true) { let c = msg[++idx]; if (c === undefined) { answer.push(dict.indexOf(w)); return answer..