def solution(array, commands):
    
    answer = []
    
    for a in range(len(commands)):
        answer_p = []
        for b in array[commands[a][0]-1:commands[a][1]]:
            answer_p.append(b)
        answer.append(sorted(answer_p)[commands[a][2]-1])
        
    return answer

 

def solution(array, commands):
    answer = []
    for x in commands:
        first, last, target = x
        answer.append(sorted(array[first-1:last])[target-1])
    return answer

+ Recent posts