https://school.programmers.co.kr/learn/courses/30/lessons/68936
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
const solution = (arr) => {
return (quadTree = (arr, y, x, n, result) => {
for (let i = y; i < y + n; ++i) {
for (let j = x; j < x + n; ++j) {
if (arr[y][x] !== arr[i][j]) {
n = Math.floor(n / 2);
for (let [ny, nx] of [[y, x], [y, x + n], [y + n, x], [y + n, x + n]])
result = quadTree(arr, ny, nx, n, result);
return result;
}
}
}
return arr[y][x] === 0
? [result[0] + 1, result[1]]
: [result[0], result[1] + 1];
})(arr, 0, 0, arr.length, [0, 0]);
};
GitHub - developeSHG/Algorithm-Baekjoon_Programmers: 백준 and 프로그래머스 소스코드
백준 and 프로그래머스 소스코드. Contribute to developeSHG/Algorithm-Baekjoon_Programmers development by creating an account on GitHub.
github.com
'Coding Test > Programmers' 카테고리의 다른 글
[Programmers] Lv 2. 숫자 변환하기 (0) | 2023.03.09 |
---|---|
[Programmers] (월간 코드 챌린지 시즌1) Lv 2. 삼각 달팽이 (0) | 2023.03.08 |
[Programmers] (월간 코드 챌린지 시즌2) Lv 2. 2개 이하로 다른 비트 (0) | 2023.03.07 |
[Programmers] Lv 2. 덧칠하기 (0) | 2023.03.07 |
[Programmers] (2018 KAKAO BLIND RECRUITMENT) Lv 2. [1차] 프렌즈4블록 (0) | 2023.03.06 |
댓글