https://school.programmers.co.kr/learn/courses/30/lessons/148653
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
function solution(storey) {
storey = storey.toString();
let result = Infinity;
(dfs = (pivot, acc, add) => {
if (pivot < 0) {
result = Math.min(result, acc + add);
return result;
}
const num = parseInt(storey[pivot]) + add;
dfs(pivot - 1, acc + num, 0);
dfs(pivot - 1, acc + 10 - num, 1);
})(storey.length - 1, 0, 0);
return result;
}
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.04.04 |
---|---|
[Programmers] Lv 2. 호텔 대실 (0) | 2023.04.03 |
[Programmers] Lv 0. 옹알이 (0) | 2023.03.28 |
[Programmers] (2019 KAKAO BLIND RECRUITMENT) Lv 2. 후보키 (0) | 2023.03.28 |
[Programmers] (재귀) Lv 2. 하노이의 탑 (0) | 2023.03.28 |
댓글