문제
풀이 과정
const solutionA = (array, commands) => {
const answer = [];
for (const command of commands) {
const [i, j, k] = command;
const result = array.slice(i - 1, j).sort((a, b) => a - b)[k - 1];
answer.push(result);
}
return answer;
};
const array = [1, 5, 2, 6, 3, 7, 4];
const commands = [
[2, 5, 3],
[4, 4, 1],
[1, 7, 3],
];
const testA = solutionA(array, commands);
console.log(testA);
틀린 부분이 있거나 보충해야 할 내용이 있다면 댓글이나 DM(sungstonemin)으로 알려주시면 감사하겠습니다😄