일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 |
- 백준
- weak
- 자바
- 클로저
- concurrency
- 스위프트
- 구조체
- RxSwift
- Self
- 연산자
- 이스케이핑
- 풀이
- 알고리즘
- observable
- rx
- 안드로이드
- 생명주기
- 옵셔널
- 해시
- noncopyable
- View
- 차이
- 프로퍼티
- ios
- Subject
- 프로그래머스
- Swift
- 프래그먼트
- async
- 리스트뷰
- Today
- Total
목록풀이 (4)
study record
import Foundation func BJ1292(){ let nums = readLine()!.split(separator: " ").map{ Int($0)} var arr: [Int] = [] var count = 1 var n = 1 for _ in 1...1000 { arr.append(n) if count < n { count += 1 }else{ n += 1 count = 1 } } var sum = 0 for i in nums[0]!...nums[1]! { sum += arr[i-1] } print(sum) } func BJ1292plus(){ // 더 깔끔한 풀이 var arr: [Int] = [] for i in 1..
let n: Int = Int(readLine()!)! var str: String = "" for _ in 0..
더 맵게 PriorityQueue 를 사용하는 문제 heap은 정렬하지 않아도 peek()이나 poll()하면 가장 작은 값이 나온다. 힙은 우선순위 큐를 위해 만들어진 자료구조로, 부모노드 키 값이 자식 노드 키 값보다 항상 크거나 작다. import java.util.PriorityQueue; public class Spicer { public int solution(int[] scoville, int K) { int answer = 0; PriorityQueue heap = new PriorityQueue(); for (int i = 0; i K) { if(heap.siz..
완주하지못한 선수 HashMap을 이용한 문제 풀이 hash.put(key, value), hash.get(key)를 이용한 문제풀이를 진행했다. import java.util.HashMap; public class Hash { public static void main(String[] args) { String[] participant = {"marina", "josipa", "nikola", "vinko", "filipa"}; String[] completion = {"josipa", "filipa", "marina", "nikola"}; System.out.println(solution(participant, completion)); } public static String solution(Stri..