본문 바로가기

Tech/[PS] Reviews

[프로그래머스-코딩 기초 트레이닝] 카운트 다운

Hi, There!
안녕하세요, 바오밥입니다.


목차

  • 문제
  • 풀이

 


문제

문제 내용

https://school.programmers.co.kr/learn/courses/30/lessons/181899


풀이

나의 풀이

class Solution {
    public int[] solution(int start, int end) {
        int[] answer = new int[start-end+1];
        int idx = 0;
        for(int i=start; i>=end; i--) {
            answer[idx] = i;
            idx++;
        }
        return answer;
    }
}