목록2024/04/17 (1)
Dazzling 개발 노트
[프로그래머스] 콜라 문제 (Java)
[프로그래머스] 콜라 문제 (Java) 문제 https://school.programmers.co.kr/learn/courses/30/lessons/132267 풀이/후기 문제를 보자마자 재귀로 풀어야겠다는 생각이 들었다. 평소 재귀에 약해서 두려움이 있었지만, 최대한 재귀로 풀기 위해 신경썼다. 다른 사람들 풀이를 보니 더욱 간단한 방법도 있는 것 같지만, 그래도 만족스럽다^_^ 코드 class Solution { static int answer = 0; public int solution(int a, int b, int n) { return colla(a, b, n); } static int colla(int a, int b, int n){ if (n < a) return answer; int out..
Algorithm/프로그래머스
2024. 4. 17. 17:42