728x90
https://school.programmers.co.kr/learn/courses/30/lessons/42748
소스코드
using System;
public class Solution
{
public int[] solution(int[] array, int[,] commands)
{
int[] answer = new int[commands.GetLength(0)];
for (int a = 0; a < commands.GetLength(0); a++)
{
int i = commands[a, 0] - 1;
int j = commands[a, 1] - 1;
int k = commands[a, 2] - 1;
int tempLen = j - i + 1;
int[] temp = new int[j - i + 1];
Array.Copy(array, i, temp, 0, tempLen);
Array.Sort(temp);
answer[a] = temp[k];
}
return answer;
}
}
728x90
'코딩공부 > 프로그래머스' 카테고리의 다른 글
[프로그래머스]Lv.1 소수 만들기 C# (소수인지 확인) (0) | 2023.06.15 |
---|---|
[프로그래머스]Lv.1 예산 C# (0) | 2023.06.15 |
※[프로그래머스]Lv.1 모의고사 C# (나머지 값 활용) (0) | 2023.06.15 |
※[프로그래머스]Lv.1 체육복 C#(except) (0) | 2023.06.15 |
[프로그래머스]Lv.1 두 개 뽑아서 더하기 C# (0) | 2023.06.15 |