def drop(array,value):
for idx in range(len(array)):
if array[idx] == value:
i = idx
break
dropped_array = array[:i] + array[i+1:]
return dropped_array
def sort(sub_list):
sorted_l = []
while len(sub_list)>0:
drop_element = min(sub_list)
sorted_l.append(drop_element)
sub_list = drop(sub_list,drop_element)
return sorted_l
def solution(array, commands):
answer = []
for el in range(len(commands)):
command = commands[el]
i = command[0];j=command[1];k=command[2]
sub_list = array[i-1:j]
sorted_list = sort(sub_list)
answer.append(sorted_list[k-1])
return answer