https://programmers.co.kr/learn/courses/30/lessons/12979
class Solution {
public int solution(int n, int[] stations, int w) {
int answer = 0;
int temp=0;
for(int i=0;i<n;i++){
if(temp>=stations.length||i<stations[temp]-1-w){
answer++;
i += 2*w;
}
else{
i= stations[temp]-1+w;
temp++;
}
}
return answer;
}
}