Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ecae046

Browse files
Merge pull request #5 from printSANO/master
[AL]k번째 Programmers Easy
2 parents 73776f1 + 504f78a commit ecae046

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

‎RyanLee/Programmers/k번째.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package Programmers;
2+
import java.util.*;
3+
public class k번째 {
4+
public int[] solution(int[] array, int[][] commands) {
5+
int[] answer = new int[commands.length];
6+
int order =0;
7+
for (int x=0; x <commands.length; x++){
8+
int i = commands[x][0];
9+
int j = commands[x][1];
10+
int k = commands[x][2];
11+
12+
int[] range = new int[j-i+1];
13+
14+
int z = 0;
15+
for(int y=i-1; y<j; y++){
16+
range[z++]=array[y];
17+
}
18+
Arrays.sort(range);
19+
answer[order++]=range[k-1];
20+
}
21+
return answer;
22+
}
23+
}

‎RyanLee/ryan.java

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /