프로그래머스 - 덧칠하기
part8. 덧칠하기
js
function solution(n, m, section) {
let temp = 0;
return section.reduce((acc, el) => {
if (el > temp) {
temp = el + m - 1;
acc++;
}
return acc;
}, 0);
}