본문 바로가기
자바 코딩테스트/프로그래머스

프로그래머스 level 0부터 시작하는 코딩테스트 - 아이스 아메리카노

by S.T.Lee 2022. 11. 14.
class Solution {
    public int[] solution(int money) {
        int[] answer = new int[2];
        int a = money/5500;
        int b = money - a*5500;
        answer[0] = a;
        answer[1] = b;
        return answer;
    }
}

개인적으로는 하단의 코드를 선호한다.

class Solution {
    public int[] solution(int money) {
        return  new int[] { money / 5500, money % 5500 };
    }
}