Skip to content

[Algorithm] 요격 시스템 #242

Description

@hwangJi-dev

https://school.programmers.co.kr/learn/courses/30/lessons/181188

import Foundation
func solution(_ targets:[[Int]])->Int{vartargets= targets.sorted(by:{$0[0]<$1[0]})letf= targets.removeFirst()varqueue:[(Int,Int)]=[(f[0],f[1])]varans=1fortin targets {iflet q = queue.last {if q.1>t[0]{if q.1>t[1]{queue[queue.count -1].1=t[1]}}else{
queue.append((t[0],t[1]))
ans +=1}}}return ans
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions