230809 덧칠하기

Jongleee·2023년 8월 9일
0

TIL

목록 보기
333/576
public int solution(int n, int m, int[] section) {
	int roller = section[0];
	int cnt = 1;
	for (int s : section) {
		if (s > roller + m - 1) {
			cnt++;
			roller = s;
		}
	}
	return cnt;
}

출처:https://school.programmers.co.kr/learn/courses/30/lessons/161989

1개의 댓글

comment-user-thumbnail
2023년 8월 9일

많은 도움이 되었습니다, 감사합니다.

답글 달기