[프로그래머스] 배열 두배 만들기

sunset.kwon·2023년 2월 16일
0

Algorithm

목록 보기
2/2

문제 설명

정수 배열 numbers가 매개변수로 주어집니다. numbers의 각 원소에 두배한 원소를 가진 배열을 return하도록 solution 함수를 완성해주세요.

class Solution {
    public int[] solution(int[] numbers) {
        int[] answer = new int[numbers.length];
        for(int i = 0; i<numbers.length; i++){
        	answer[i] = numbers[i]*2;
        }
        return answer;
    }
}
profile
더디지만, 자라나는 중입니다.

0개의 댓글