Notice
Recent Posts
Recent Comments
- Today
- Total
01-10 22:06
Tags
- ์๋ฃ๊ตฌ์กฐ
- ํ๋ก๊ทธ๋๋จธ์ค
- dp
- CS
- ๋ฒจ๋งํฌ๋
- java
- ์๋ฐ
- ๋ฐฑ์๋
- ๋ค์ต์คํธ๋ผ
- spring
- Graph
- tree
- ๊ตฌํ
- Algorithm
- ๋ฐ์ดํฐ๋ฒ ์ด์ค
- pytorch
- OOP
- ์์์ ๋ ฌ
- BFS
- database
- array
- MST
- ๋ฌธ๋ฒ
- ๊ทธ๋ฆฌ๋
- ์กธ์ ์ํ
- ์๋ฐ์์ ์
- ์ธํด
- ๋ฐฑ์ค
- leetcode
- PS
Link
Partially Committed
[์ ๋ ฌ] K ๋ฒ์งธ์ (JAVA) ๋ณธ๋ฌธ
728x90
๋ฐ์ํ
SMALL
https://school.programmers.co.kr/learn/courses/30/lessons/42748?language=java
import java.io.IOException;
import java.util.Arrays;
class Solution{
public int[] solution(int[] array, int[][] commands) throws IOException {
int[] answer = new int[commands.length];
int t = commands.length;
for(int i = 0 ; i < t ; i++){
int s = commands[i][0];
int e = commands[i][1];
int k = commands[i][2];
int[] temp = Arrays.copyOfRange(array, s-1, e);
Arrays.sort(temp);
answer[i] = temp[k-1];
}
return answer;
}
}
728x90
๋ฐ์ํ
LIST
'๐ฅ Algorithm || ๋ฌธ์ ํ์ด > PS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฐ์ด] ๊ฐ์ ์ซ์๋ ์ซ์ด (JAVA) (0) | 2022.09.02 |
---|---|
[์ ๋ ฌ] ๊ฐ์ฅ ํฐ ์ (JAVA) (0) | 2022.09.02 |
[ํ๋ก๊ทธ๋๋จธ์ค] ํฐ ์ ๋ง๋ค๊ธฐ (0) | 2022.07.14 |
[ํ๋ก๊ทธ๋๋จธ์ค] ๊ฒ์ ๋งต ์ต๋จ๊ฑฐ๋ฆฌ (0) | 2022.07.14 |
[ํ๋ก๊ทธ๋๋จธ์ค] ์์ฅ (0) | 2022.07.13 |
Comments