문제
풀이 과정
const solutionA = (progresses, speeds) => {
const answer = [];
const deployDay = [];
for (let i = 0; i < progresses.length; i++) {
const minus = 100 - progresses[i];
const quotient = Math.floor(minus / speeds[i]);
const remainder = minus % speeds[i];
if (remainder > 0) deployDay.push(quotient + 1);
else deployDay.push(quotient);
}
let leftPoint = 0;
let rightPoint = 1;
let count = 1;
while (rightPoint <= deployDay.length) {
if (deployDay[leftPoint] >= deployDay[rightPoint]) {
rightPoint++;
count++;
} else {
answer.push(count);
leftPoint = rightPoint;
rightPoint += 1;
count = 1;
}
}
return answer;
};
const progresses = [93, 30, 55];
const speeds = [1, 30, 5];
const testA = solutionA(progresses, speeds);
console.log(testA);
틀린 부분이 있거나 보충해야 할 내용이 있다면 댓글이나 DM(sungstonemin)으로 알려주시면 감사하겠습니다😄