반응형
기지국 설치
-
[CodeKata] 프로그래머스: 1.10(월), 기지국 설치Algorithm 2022. 1. 10. 03:44
🥋 Oooth More!! (Level 3) 🧮 풀이 function solution(n, stations, w) { let sects = stations.reduce((acc, cur) => [...acc, cur-w-2, cur+w], []) let start_block, end_block = false; const r = 2*w + 1; let answer = 0; if (sects[0] n-1) { sects.pop(); end_block = true; } if (!start_block) sects.unshift(0); if(!end_block) sects.push(n-..