https://school.programmers.co.kr/learn/courses/30/lessons/120862
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
나의 풀이
import java.util.*;
class Solution {
public int solution(int[] numbers) {
int answer = 0;
Arrays.sort(numbers);
int max = -2147483648;
int n = numbers.length;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if (numbers[i]*numbers[n-1-j]>=max&&i!=n-1-j){
max = numbers[i]*numbers[n-1-j];
}
}
}
return max;
}
}
'💡 Codeing Test > 프로그래머스' 카테고리의 다른 글
프로그래머스) 두 개 뽑아서 더하기 (0) | 2023.03.23 |
---|---|
프로그래머스) 문자열 내 마음대로 정렬하기 (python) (0) | 2023.03.23 |
프로그래머스) 124나라의 숫자 (Java & Python) (0) | 2023.03.05 |
프로그래머스) n의 배수 고르기 (0) | 2023.03.05 |
프로그래머스) 문자열 정렬하기 (1) (JAVA) (0) | 2023.03.04 |