1
Этап 1: Техническое собеседование (анализ кода)
1. Задача: Работа с Hashable и словарями в Swift
struct Key {
let id: Int
let title: String
}
extension Key: Hashable {
func hash(into hasher: inout Hasher) {
hasher.combine(self.id)
}
}
var dict = [Key: Int]()
let key1 = Key(id: 1, title: "Key1")
let key2 = Key(id: 2, title: "Key2")
dict[key1] = 1058
dict[key2] = 368
// 1
print(dict.count)
let key3 = Key(id: 1, title: "Key3")
dict[key3] = 400
// 2
print(dict.count)- Что будет выведено в консоль после выполнения
print(dict.count)в строках, помеченных// 1и// 2?
2.…