분류 전체보기

코딩테스트/codetree

[코드트리 조별과제] 6주차 학습

Intermediate Mid / Greedy / greedy Algorithm 해당 문제는 회의실을 겹치지 않게 최대로 선택하기 위해 제외해야 되는 개수를 출력해야 되는 문제입니다. [입력 범위]1 0  [예제 입력 1]70 11 98 232 33 47 84 6 [예제 출력 1]1 [정답 코드 + 해설]더보기더보기더보기n = int(input())li = [[*map(int,input().split())]for _ in range(n)]li.sort(key = lambda x:(x[1], x[0]))end = 0cnt = 0for s,e in li: if end  끝나는 시간을 기준으로 오름차순으로 정렬하고 for문으로 전에 있던 시간보다 현재 시작하는 시간이 크거나 같다면바로 회의를 시작할 수 ..

코딩테스트/codetree

[코드트리 조별과제] 5주차 학습

최근에 다시 알고리즘 공부를 하기 시작했습니다. 친구과 함께 하루에 백준에서 골드2문제를 랜덤으로 뽑아서 진행을 하고, 남은 시간에는 코드트리의 커리큘럼에 따라서 문제를 풀이하고 정리하려고 합니다.  [코드트리] Intermediate Low / BFS / BFS탐색 문제는 단순하게 n * m 이차원 영역이 주어지고, 해당 영역에는 뱀이 서식합니다.이 뱀들은 움직이지 않으며, 저희는 (0, 0) 지역에서 (n-1, m-1) 지역까지 이동할 수 있는지 판단내리면 됩니다. [입력 범위]2 [예제 입력 1]5 51 0 1 1 11 0 1 0 11 0 1 1 11 0 1 0 11 1 1 0 1[출력 1]1 [정답 코드]더보기from collections import dequen,m = map(int,input(..

자료구조/by swift

swift PriorityQueue 구현

swift로 우선순위 큐를 구현했습니다. /* base on : Array, binary Tree */ class PriorityQueue{ private var elements: [T] = [] private let compare: (T, T) -> Bool var top: T?{elements.first} var isEmpty: Bool{elements.isEmpty} var count: Int{elements.count} init(){ compare = {$0 Bool){ self.compare = compare // 정렬 기준을 받아서 덮어쓰기 } func pus..

자료구조/by swift

swift Double-LinkedList 구현

https://en.wikipedia.org/wiki/Doubly_linked_list Doubly linked list - Wikipedia From Wikipedia, the free encyclopedia Linked list data structure In computer science, a doubly linked list is a linked data structure that consists of a set of sequentially linked records called nodes. Each node contains three fields: two link fields (refe en.wikipedia.org 위키피디아에서 어떤 메소드를 갖고 있어야 하며, 어떤 프로퍼티가 있는지만 확인하..

자료구조/by swift

swift queue 구현

저번에 이어서 이번에는 queue 구현 코드이다. class Queue{ private var backStack = Stack() private var frontStack = Stack() var isEmpty : Bool{ return backStack.isEmpty && frontStack.isEmpty } var front : Any?{ guard backStack.isEmpty || frontStack.isEmpty else {return nil} if !frontStack.isEmpty {return frontStack.top} while !backStack.isEmpty { if let top = backStack.pop() { frontStack.push(top) } } return fron..

자료구조/by swift

swift stack 구현

swift로 stack을 구현해봤습니다. struct Stack{ private var elements: [T] = [] mutating func push(_ element : T){ elements.append(element) } mutating func pop() -> T?{ return elements.popLast() ?? nil } var top: T?{ return elements.last ?? nil } var isEmpty : Bool{ return elements.isEmpty } } 위와 같이 구현해봤는데.. 흠 좋은 거 같기도 ㅎ고 아닌 거 같기도 하고 ..

언어 공부/swift

[Swift] Day 1 개발환경 구축

저번 시간까지 Swift의 짤막한 이론(?) 시간을 가져봤고 이번시간부터 본격적으로 swift 문법 공부를 시작해 보겠습니다. 일단 들어가기에 앞서서, 제가 틀린 부분이 있을 수 있습니다. 그런 부분은 과감히 거르고 댓글로 알려주시면 감사하겠습니다. 시작하겠습니다. 우선 문법공부를 하기 전에 해줘야 하는 것이 개발환경 구축입니다. Appstore에서 xcode를 검색하여 설치해 봅시다. xcode라는 것이 보이실 것입니다. 저것을 설치해 주시면 됩니다. 설치가 모두 되었다면, playground를 한 번 만들어봅시다. 여기서 playground가 무엇이냐! (저도 잘 모릅니다..) swift 코드를 작성하고 실행해 보는 곳이라고 할 수 있습니다. 아래 사진의 과정을 따라 해주세요! 이렇게 뜨게 되고 왼쪽..

언어 공부/swift

[Swift] Day 0 스위프트란?

모든 포스터는 애플 공식 홈페이지의 swift 문서를 참고하고 있으며, 각종 다른 블로그들의 글들을 참고할 수 있다. 그러므로 참고할 때마다 해당하는 문서의 원본 페이지를 본문의 하단부에 기입해 놓겠습니다. 또한 다른 언어와 많은 비교가 있을 것입니다. (C, Kotlin, Java..) 스위프트 공식문서를 따라가면 Swift includes modern features like type inference, optionals, and closures, which make the syntax concise yet expressive. Swift ensures your code is fast and efficient, while its memory safety and native error handling ..

견우직녀달
'분류 전체보기' 카테고리의 글 목록