Skip to main content

K번째수

Solution

function solution(array, commands) {
return commands.reduce(
(acc, [start, end, target]) => [
...acc,
array.slice(start - 1, end).sort((a, b) => a - b)[target - 1],
],
[]
);
}

Review

.

References