728x90
반응형
SMALL
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<int> numbers) {
int answer = 0;
sort(numbers.begin(), numbers.end());
int cmp1 = numbers[0]*numbers[1];
sort(numbers.rbegin(), numbers.rend());
int cmp2 = numbers[0]*numbers[1];
return cmp1 > cmp2? cmp1:cmp2;
}
728x90
반응형
LIST
'C++' 카테고리의 다른 글
[프로그래머스] 대문자와 소문자 (0) | 2025.09.05 |
---|---|
[프로그래머스] 암호 해독 (0) | 2025.09.05 |
[프로그래머스] 숨어있는 숫자의 덧셈 (1) (0) | 2025.09.05 |
[프로그래머스] 문자열 정렬하기 (1) (0) | 2025.09.05 |
[프로그래머스] 주사위의 개수 (0) | 2025.09.05 |
댓글