This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class Solution { | |
func lengthOfLIS(_ nums: [Int]) -> Int { | |
var tails: [Int] = [nums[0]] | |
for index in 1 ..< nums.count { | |
if nums[index] > tails.last! { | |
tails.append(nums[index]) | |
} else { | |
tails[binarySearch(tails, target: nums[index])] = nums[index] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class Solution { | |
func lengthOfLIS(_ nums: [Int]) -> Int { | |
var dp: [Int] = .init(repeating: 1, count: nums.count) | |
for i in 1..<nums.count { | |
for j in 0..<i where dp[i] <= dp[j] && nums[j] < nums[i] { | |
dp[i] = dp[j] + 1 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import Vapor | |
import OpenAPIRuntime | |
import OpenAPIVapor | |
struct GreetingService: APIProtocol { | |
func getGreeting(_ input: Operations.getGreeting.Input) async throws -> Operations.getGreeting.Output { | |
let name = input.query.name ?? "Stranger" | |
let greeting = Components.Schemas.Greeting(message: "Hello, \(name)!") | |
return .ok(.init(body: .json(greeting))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vapor | |
let app = Application() | |
try app.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: "3.1.0" | |
info: | |
title: "App" | |
version: "1.0.0" | |
servers: | |
- url: "https://api.path.com/v1" | |
description: "Production Server" | |
- url: "https://localhost/v1" | |
description: "Internal staging server for testing" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// swift-tools-version: 5.10 | |
import PackageDescription | |
let package = Package( | |
name: "OpenAPIService", | |
platforms: [ | |
.macOS(.v14), | |
], | |
dependencies: [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Author: SwiftUI-Lab (www.swiftui-lab.com) | |
// Description: This code is part of the "Advanced SwiftUI Animations - Part 5" | |
// Article: https://swiftui-lab.com/swiftui-animations-part5/ | |
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
ClockView() | |
.background(.gray) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Queue<Element> { | |
private var frontArray: [Element] = [] | |
private var backArray: [Element] = [] | |
mutating func append(_ element: Element) { | |
backArray.append(element) | |
} | |
mutating func popFirst() -> Element? { | |
if !frontArray.isEmpty { return frontArray.popLast() } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 합승 택시 요금 문제 풀이 | |
struct Number72413 { | |
/// 합승 택시 요금 문제 풀이 | |
/// - Parameters: | |
/// - n: 지점의 개수 | |
/// - startNumber: 시작 정점 | |
/// - a: A의 목표 정점 | |
/// - b: B의 목표 정점 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 미로 탈출 명령어 | |
// https://school.programmers.co.kr/learn/courses/30/lessons/150365 | |
// | |
// Created by whitehyun on 2023/08/15. | |
// | |
import Foundation | |
struct Queue<Element> { |
NewerOlder