This file contains hidden or 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 UniformTypeIdentifiers | |
| let allTypes: [UTType] = [ | |
| .item, | |
| .content, | |
| .compositeContent, | |
| .diskImage, | |
| .data, | |
| .directory, |
This file contains hidden or 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 AppKit | |
| import Combine | |
| import CombineExt | |
| import Foundation | |
| import SharedUtils | |
| // sourcery: Automockable | |
| protocol RunningApplicationsObserverType { | |
| func observeApplicationsRunningStatus(bundleIdentifiers: [String]) -> AnyPublisher<Void, Never> | |
| } |
This file contains hidden or 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
| class Solution { | |
| func networkDelayTime(_ times: [[Int]], _ n: Int, _ k: Int) -> Int { | |
| var graph: [Int: [(Int, Int)]] = [:] | |
| for time in times { | |
| var edges = graph[time[0]] ?? [] | |
| edges.append((time[1], time[2])) | |
| graph[time[0]] = edges | |
| } | |
| struct HeapNode: Comparable { |
This file contains hidden or 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
| // Time: O(MxN*3^L) | |
| // Space: O(L), don't count matrix change | |
| class Solution { | |
| let dt: [[Int]] = [[0, 1], [0, -1], [1, 0], [-1, 0]] | |
| func exist(_ board: [[Character]], _ word: String) -> Bool { | |
| var board = board | |
| let word: [Character] = Array(word) | |
| var locs: [[Int]] = [] |
This file contains hidden or 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
| // Time: O(NxK) | |
| // Space: O(NxK) - need to store the results somewhere | |
| class Solution { | |
| func mergeKLists(_ lists: [ListNode?]) -> ListNode? { | |
| var tops = lists.compactMap { $0 ?? nil } | |
| var resultRoot: ListNode? | |
| var resultLast: ListNode? | |
| while tops.count > 0 { | |
| var pickIdx = 0 | |
| var val = Int.max |
This file contains hidden or 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
| class Solution { | |
| func removePalindromeSub(_ s: String) -> Int { | |
| guard s.count > 0 else { return 0 } | |
| if isPalindrome(s) { return 1 } | |
| return 2 | |
| } | |
| private func isPalindrome(_ s: String) -> Bool { | |
| let b = "b".utf8CString[0] |
OlderNewer