[프로그래머스] 두 개 뽑아서 더하기 (JAVA)
프로그래머스 Level1 두 개 뽑아서 더하기 (월간 코드 챌린지 시즌1) 문제 정수 배열 numbers가 주어집니다. numbers에서 서로 다른 인덱스에 있는 두 개의 수를 뽑아 더해서 만들 수 있는 모든 수를 배열에 오름차순으로 담아 return 하도록 solution 함수를 완성해주세요. 예시 numbers result [2,1,3,4,1] [2,3,4,5,6,7] [5,0,2,7] [2,5,7,9,12] 풀이 import java.util.*; class Solution { public int[] solution(int[] numbers) { int[] answer = {}; List list = new ArrayList(); Arrays.sort(numbers); int t = 0; for(i..
2024. 3. 14.