[프로그래머스]짝수는 싫어요

박예림·2023년 2월 28일
0

코테

목록 보기
23/132

class Solution {
    public int[] solution(int n) {
        int[] answer = new int[(n+1)/2];
        int j =1;
        for (int i=0; i<answer.length; i++){
            answer[i] = j;
            j+=2;
        }
        
        return answer;
    }
}
profile
응애 나 아기개발자

0개의 댓글