Skip to content

Commit d53858c

Browse files
committed
[level 0] Title: 최댓값 만들기 (1), Time: 0.35 ms, Memory: 77.5 MB -BaekjoonHub
1 parent 9ab780a commit d53858c

2 files changed

Lines changed: 84 additions & 0 deletions

File tree

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# [level 0] 최댓값 만들기 (1) - 120847
2+
3+
[문제 링크](https://school.programmers.co.kr/learn/courses/30/lessons/120847)
4+
5+
### 성능 요약
6+
7+
메모리: 77.5 MB, 시간: 0.35 ms
8+
9+
### 구분
10+
11+
코딩테스트 연습 > 코딩테스트 입문
12+
13+
### 채점결과
14+
15+
정확성: 100.0<br/>합계: 100.0 / 100.0
16+
17+
### 제출 일자
18+
19+
2026년 05월 07일 16:46:31
20+
21+
### 문제 설명
22+
23+
<p>정수 배열 <code>numbers</code>가 매개변수로 주어집니다. <code>numbers</code>의 원소 중 두 개를 곱해 만들 수 있는 최댓값을 return하도록 solution 함수를 완성해주세요.</p>
24+
25+
<hr>
26+
27+
<h5>제한사항</h5>
28+
29+
<ul>
30+
<li>0 ≤ <code>numbers</code>의 원소 ≤ 10,000</li>
31+
<li>2 ≤ <code>numbers</code>의 길이 ≤ 100</li>
32+
</ul>
33+
34+
<hr>
35+
36+
<h5>입출력 예</h5>
37+
<table class="table">
38+
<thead><tr>
39+
<th>numbers</th>
40+
<th>result</th>
41+
</tr>
42+
</thead>
43+
<tbody><tr>
44+
<td>[1, 2, 3, 4, 5]</td>
45+
<td>20</td>
46+
</tr>
47+
<tr>
48+
<td>[0, 31, 24, 10, 1, 9]</td>
49+
<td>744</td>
50+
</tr>
51+
</tbody>
52+
</table>
53+
<hr>
54+
55+
<h5>입출력 예 설명</h5>
56+
57+
<p>입출력 예 #1</p>
58+
59+
<ul>
60+
<li>두 수의 곱중 최댓값은 4 * 5 = 20 입니다.</li>
61+
</ul>
62+
63+
<p>입출력 예 #1</p>
64+
65+
<ul>
66+
<li>두 수의 곱중 최댓값은 31 * 24 = 744 입니다.</li>
67+
</ul>
68+
69+
70+
> 출처: 프로그래머스 코딩 테스트 연습, https://school.programmers.co.kr/learn/challenges
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import java.util.*;
2+
3+
class Solution {
4+
public int solution(int[] numbers) {
5+
int answer = 0;
6+
7+
Arrays.sort(numbers);
8+
int length = numbers.length;
9+
10+
answer = numbers[length-1] * numbers[length-2];
11+
12+
return answer;
13+
}
14+
}

0 commit comments

Comments
 (0)