일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- C++
- nestedlists
- secondlowestgrade
- 2022
- ingress-nginx
- swift
- 프로그래머스
- LEVEL 2
- Code Jam 2022
- 파이썬
- Qualification Round
- GitLab
- ESXi 업데이트
- 방송통신대학교 대학원 정보과학과
- 정보과학과
- 해커랭크
- 코딩테스트
- 하늘과 바람과 별과 시
- on-prem
- 방통대 대학원 정보과학과
- Kubernetes
- MySQL
- 3D PRINTING
- hackerrank
- K8S
- openebs
- Python
- Code Jam
- 하늘과 바람과 별과 詩
Archives
- Today
- Total
공대생의 비망록
[프로그래머스][Lv. 1] K번째 수 Swift 풀이 본문
https://programmers.co.kr/learn/courses/30/lessons/42748
풀이는 추후에 차차 올리도록 하겠습니다...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import Foundation
func solution(\_ array:\[Int\], \_ commands:\[\[Int\]\]) -> \[Int\] {
var ans = \[Int\]()
var temp = \[Int\]()
for command in commands {
temp = array
temp.removeLast(temp.count - command\[1\])
temp.removeFirst(command\[0\] - 1)
temp.sort()
ans.append(temp\[command\[2\] - 1\])
}
return ans
}
|
cs |
'Programming Language > Swift' 카테고리의 다른 글
[프로그래머스][Lv. 1] 체육복 Swift 풀이 (0) | 2022.03.14 |
---|---|
[프로그래머스][Lv. 1] 모의고사 Swift 풀이 (0) | 2022.03.14 |
[프로그래머스][Lv. 1] 소수 만들기 Swift 풀이 (0) | 2022.03.14 |
[프로그래머스][Lv. 1] 내적 Swift 풀이 (0) | 2022.03.14 |
[프로그래머스][Lv. 1] 음양 더하기 Swift 풀이 (0) | 2022.03.14 |
Comments