[Swift] built-in Heap
\n\n# Code\n\nimport Collections\n\nclass Solution {\n    func findMaximizedCapital(_ k: Int, _ w: Int, _ profits: [Int], _ capital: [Int]) -> Int {\n        va
\n\n# Code\n```\nimport Collections\n\nclass Solution {\n    func findMaximizedCapital(_ k: Int, _ w: Int, _ profits: [Int], _ capital: [Int]) -> Int {\n        var projects = zip(profits, capital).map(Project.init).sorted { $0.capital > $1.capital }\n        var hp: Heap<Project> = []\n        var currentCapital = w\n\n        for _ in 1...k {\n            while let minCapitalProject = projects.last, minCapitalProject.capital <= currentCapital {\n                hp.insert(projects.removeLast())\n            }\n\n            guard let maxProfitProject = hp.popMax() else { break }\n\n            currentCapital += maxProfitProject.profit\n        }\n\n        return currentCapital\n    }\n}\n\nstruct Project: Comparable {\n    let profit: Int\n    let capital: Int\n\n    static func <(lhs: Project, rhs: Project) -> Bool {\n        lhs.profit < rhs.profit\n    }\n}\n```
['Swift', 'Sorting', 'Heap (Priority Queue)']