💾 코드
using System;
using System.Linq;
public class Solution {
public int[] solution(int[] array, int[,] commands) {
int[] answer = new int[commands.GetLength(0)];
for (int i = 0; i < commands.GetLength(0); i++) {
var tempArray = array
.Skip(commands[i, 0] - 1)
.Take(commands[i, 1] - commands[i, 0] + 1)
.OrderBy(x => x)
.ToArray();
answer[i] = tempArray[commands[i, 2] - 1];
}
return answer;
}
}
📖 참고
참고할 코드 내용