programming/iOS/practice
// Arrays import Foundation import XCTest // 1,2,5 11 // Uber set class Solution { class Solution { func partitionString(s: String) -> [String] { var partitions = [String]() var currentPartition = "" var seenLetters = Set<Character>() for letter in s { if seenLetters.contains(letter) { partitions.append(currentPartition) currentPartition = "" seenLetters.removeAll() } currentPartition += String(letter) seenLetters.insert(letter) } if !currentPartition.isEmpty { partitions.append(currentPartition) } return partitions } func topKFrequent(nums: [Int], k: Int) -> [Int] { // Create a dictionary to keep track of the frequency of each element var frequencyDict = [Int: Int]() for num in nums { frequencyDict[num, default: 0] += 1 } // Create a min heap to store the elements based on their frequency var heap = MinHeap<(Int, Int)> { $0....