
[프로그래머스, Java] 덧칠하기
·
CodingTest/Programmers
💡풀이import java.util.Arrays;import java.util.stream.IntStream;class Solution { public int solution(int n, int m, int[] section) { boolean[] painted = new boolean[n + 1]; Arrays.fill(painted, true); // n을 1로 채운 배열로 만든다 for (int s : section) { // section 위치는 0으로 바꾼다 painted[s] = false; } int count = 0; // section으로 분기한다 for (int i = 0;..