코딩테스트/프로그래머스
[3] N으로 표현
int answer = 9; int goal = 0; void cal(int n, int cnt, int sum) { if (cnt > 8) return; if (sum == goal && answer > cnt) answer = cnt; int tmp = 0; for (int i = 1; i 8) ? -1 : answer; }
int answer = 9; int goal = 0; void cal(int n, int cnt, int sum) { if (cnt > 8) return; if (sum == goal && answer > cnt) answer = cnt; int tmp = 0; for (int i = 1; i 8) ? -1 : answer; }