https://programmers.co.kr/learn/courses/30/lessons/42586
import java.util.*;
class Solution {
public int[] solution(int[] progresses, int[] speeds) {
int time = 0;
int i=0;
int cnt=0;
boolean check[] = new boolean[speeds.length];
Arrays.fill(check,false);
List<Integer> ans = new ArrayList<>();
while(i<speeds.length){
if(!check[i]){
time = (int)Math.ceil((double)(100-progresses[i])/(double)speeds[i]);
for(int j=i;j<speeds.length;j++){
if(progresses[j]+time*speeds[j]>=100){
check[j] = true;
cnt++;
}
else{
break;
}
}
if(cnt!=0){
ans.add(cnt);
}
}
cnt=0;
i++;
}
int answer[] = new int[ans.size()];
for(int j=0;j<ans.size();j++){
answer[j] = ans.get(j);
}
return answer;
}
}