코딩테스트 고득점 Kit - 정렬 1 (Level 1)

 

https://programmers.co.kr/learn/courses/30/lessons/42748


Code

1
2
def solution(array, commands):
    return [sorted(array[i-1:j])[k-1] for i, j, k in commands]

Complexity

$O(mn log n)$

  • $n$ = len(array)
  • $(m, k)$ = commands.shape