Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- Nullish Coalescing Operator
- Redux
- 카카오맵 api
- HTML
- spread operation
- Default parameter
- css #html
- firebase
- Python #Baekjoon
- nextjs
- Python #CodeUp
- es11
- react
- optional chanining
- es6
- HTML #CSS
- Template literals
- React Kakao map
- React #Hooks
- JavaScript
- Python
- Next
- Hooks
- CSS
- 카카오맵
- BOJ
- 프로그래머스
Archives
- Today
- Total
거북이개발자
[프로그래머스] K번째수 본문
0. 제목
- 프로그래머스 K번째수
1. 문제
https://programmers.co.kr/learn/courses/30/lessons/42748
코딩테스트 연습 - K번째수
[1, 5, 2, 6, 3, 7, 4] [[2, 5, 3], [4, 4, 1], [1, 7, 3]] [5, 6, 3]
programmers.co.kr
2. 풀이
- 리스트의 [:] 성질만 이용하면 어렵지 않다.
3. 코드
(1). 내적
def solution(array, commands):
array_sliced=[]
answer = []
for i in commands:
array_sliced=array[i[0]-1 : i[1]]
array_sliced.sort()
answer.append(array_sliced[i[2]-1])
return answer
'Algorithm(Python) > programmers(Lv.1)' 카테고리의 다른 글
[프로그래머스] 소수 만들기 (0) | 2021.06.23 |
---|---|
[프로그래머스] 모의고사 (0) | 2021.06.23 |
[프로그래머스] 내적, 로또의 최고순위와 최저순위 (0) | 2021.06.21 |
[프로그래머스] 음양 더하기 (0) | 2021.06.21 |
[프로그래머스] 체육복 (0) | 2021.06.21 |
Comments