From 4f4cdd730c2d24618a5e0ef91d1978a0ae5cb4e6 Mon Sep 17 00:00:00 2001 From: Yea Song Han <69785681+jadely-lab@users.noreply.github.com> Date: Sun, 3 Apr 2022 20:45:55 +0900 Subject: [PATCH] Create Week2_HW1 --- Week2_HW1 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Week2_HW1 diff --git a/Week2_HW1 b/Week2_HW1 new file mode 100644 index 0000000..cd88d50 --- /dev/null +++ b/Week2_HW1 @@ -0,0 +1,18 @@ +//220403 +//프로그래머스 코딩테스트 연습 K번째수 +//https://programmers.co.kr/learn/courses/30/lessons/42748 + +def solution(array, commands): + answer = [] + for a in range(len(commands)): + i = commands[a][0] + j = commands[a][1] + k = commands[a][2] + + new = array[i-1:j] + new.sort() + output = new[k-1] + answer.append(output) + new = [] + + return answer