프로그래머스 Level 1 - 둘만의 암호 (Javascript)
문제 답안 function solution(s, skip, index) { var answer = []; const alphabet = ['a','b','c','e','d','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']. filter(c=>!skip.includes(c)); return s .split('') .map((a) => alphabet[(alphabet.indexOf(a) + index) % alphabet.length]) .join(''); } 후기 알파벳에 skip에 없는 단어들로 필터링한다. 그리고 s에서 alphabet 에 있는 단어를 찾아 거기에 index만큼 더하고, alphab..
2023. 11. 20.