전체 글
-
Composable Architecture로 랜덤 통신 구현하기TCA 2021. 7. 17. 15:32
안녕하세요. 그린입니다🟢 이번 포스팅에서는 Composable Architecture으로 랜덤한 통신을 구현해보겠습니다🧑🏻💻 뷰는 SwiftUI를 통해 간단히 구현하였습니다. 우선 간략한 기능을 설명드리겠습니다. Composable Architecture를 이용하여 뷰의 상태를 이벤트 흐름에 따라 다룰 수 있는 아주 간단한 예제로 통신 시 GET에 ID 인덱스를 넘겨 통신할때 해당 인덱스를 랜덤하게 뽑고 통신 및 파싱한 후 ID와 타이틀을 UI에 3초마다 자동 갱신되도록 뷰를 업데이트 하는 기능을 가집니다🧑🏻💻 또한 수동/자동 변경 버튼을 두어 해당 조건에 따라 통신되도록 구현합니다. (이전에 ReactorKit으로 랜덤 통신을 구현한 스펙과 동일합니다.) 여기 포스팅에서는 필수 파일에 대한 구현들만..
-
시간복잡도를 고려한 알고리즘 (3)Algorithm 2021. 7. 11. 13:50
아래 문제는 코딜리티에서 제공하는 TapeEquilibrium의 문제입니다🧑🏻💻 문제 제시 A non-empty array A consisting of N integers is given. Array A represents numbers on a tape. Any integer P, such that 0 < P < N, splits this tape into two non-empty parts: A[0], A[1], ..., A[P − 1] and A[P], A[P + 1], ..., A[N − 1]. The difference between the two parts is the value of: |(A[0] + A[1] + ... + A[P − 1]) − (A[P] + A[P + 1] + ... + ..
-
ReactorKit으로 랜덤 통신 구현하기iOS 2021. 7. 10. 09:30
안녕하세요. 그린입니다🟢 이번 포스팅에서는 ReactorKit으로 랜덤한 통신을 구현해보겠습니다🧑🏻💻 우선 간략한 기능을 설명드리겠습니다. ReactorKit을 이용하여 리액터를 다룰 수 있는 아주 간단한 예제로 통신 시 GET에 ID 인덱스를 넘겨 통신할때 해당 인덱스를 랜덤하게 뽑고 통신 및 파싱한 후 ID와 타이틀을 UI에 3초마다 자동 갱신되도록 뷰를 업데이트 하는 기능을 가집니다🧑🏻💻 여기 포스팅에서는 필수 파일에 대한 구현들만 간단히 소개하고 아래 제 Git 레포 주소를 남겨두겠습니다! 더 참고하실 분들을 Git을 참고해주세요👍🏻 1. Model 1) JSON 구조체 - 통신 후 JSON 데이터를 파싱할 구조체를 생성합니다. import Foundation struct RandomInfo:..
-
시간복잡도를 고려한 알고리즘 (2)Algorithm 2021. 7. 7. 21:56
아래 문제는 코딜리티에서 제공하는 permMissingElem의 문제입니다🧑🏻💻 문제 제시 An array A consisting of N different integers is given. The array contains integers in the range [1..(N + 1)], which means that exactly one element is missing. Write a function: public func solution(_ A : inout [Int]) -> Int that, given an array A, returns the value of the missing element. For example, given array A such that: A[0] = 2 A[1] = 3..
-
ReactorKit으로 계산기 구현하기Swift 2021. 7. 5. 21:48
안녕하세요. 그린입니다🟢 이번 포스팅에서는 ReactorKit으로 계산기를 구현해보겠습니다🧑🏻💻 우선 이번 계산기 프로젝트 같은 경우에는 ReactorKit으로 어느정도 정형화된 리액트 MVVM 아키텍쳐 패턴을 따릅니다. 여기 포스팅에서는 필수 파일에 대한 구현들만 간단히 소개하고 아래 제 Git 레포 주소를 남겨두겠습니다! 더 참고하실 분들을 Git을 참고해주세요👍🏻 1. View - 뷰는 우선 스토리보드로 UI요소 배치와 오토레이아웃을 적용했습니다. - 그 후 ViewController에서 ReactorKit을 임포트하고 스토리보드뷰를 채택하여 리액트와 바인딩될 수 있게 구현하였습니다. import UIKit import ReactorKit import RxCocoa class CalculatorV..
-
시간복잡도를 고려한 알고리즘Algorithm 2021. 6. 30. 12:30
아래 문제는 코딜리티에서 제공하는 FlogJmp의 문제입니다🧑🏻💻 문제 제시 A small frog wants to get to the other side of the road. The frog is currently located at position X and wants to get to a position greater than or equal to Y. The small frog always jumps a fixed distance, D. Count the minimal number of jumps that the small frog must perform to reach its target. Write a function: class Solution { public int solution(in..
-
중복 인덱스를 활용한 알고리즘Algorithm 2021. 6. 29. 14:36
아래 문제는 코딜리티에서 제공하는 OddOccurrencesInArray의 문제입니다🧑🏻💻 문제 제시 A non-empty array A consisting of N integers is given. The array contains an odd number of elements, and each element of the array can be paired with another element that has the same value, except for one element that is left unpaired. For example, in array A such that: A[0] = 9 A[1] = 3 A[2] = 9 A[3] = 3 A[4] = 9 A[5] = 7 A[6] = 9 the e..
-
배열을 이용한 알고리즘Algorithm 2021. 6. 28. 12:12
아래 문제는 코딜리티에서 제공하는 CyclicRotation의 문제입니다🧑🏻💻 문제 제시 An array A consisting of N integers is given. Rotation of the array means that each element is shifted right by one index, and the last element of the array is moved to the first place. For example, the rotation of array A = [3, 8, 9, 7, 6] is [6, 3, 8, 9, 7] (elements are shifted right by one index and 6 is moved to the first place). The goal i..