728x90
반응형
using System;
using System.Collections.Generic;
public class Solution
{
public int[] solution(int[] array, int[,] commands)
{
int length = commands.GetLength(0);
int[] answer = new int[length];
List<int> sortingList = new List<int>();
int index = 0;
for(int i =0; i<length; ++i)
{
int start = commands[i,0] - 1;
int end = commands[i,1] - 1;
int line = commands[i,2] - 1;
sortingList.Clear();
for(int j=start; j<=end; ++j)
{
sortingList.Add(array[j]);
}
sortingList.Sort();
answer[i] = sortingList[line];
}
return answer;
}
}
반응형
'프로그래밍 > 기타' 카테고리의 다른 글
프로그래머스 - H-Index (C#) (0) | 2021.01.15 |
---|---|
프로그래머스 - 가장 큰 수 (c#) (0) | 2021.01.15 |
프로그래머스 - 베스트앨범 (C#) (0) | 2021.01.14 |
프로그래머스 - 위장 (C#) (0) | 2021.01.14 |
구글 스토어 앱 등록 (10) | 2020.10.03 |