Hello my friends!
Did i finish silver challenge correctly ?
extension Stack: Equatable where Element: Equatable {
static func == (lhs: Stack<Element>, rhs: Stack<Element>) -> Bool {
return lhs.items.count == rhs.items.count && lhs.items.enumerated().first(where: { $1 != rhs.items[$0] }) == nil
}
}
let myTasks = Stack(items: ["Zelim", "Zurab"])
let yourTasks = Stack(items: ["Zelim"])
myTasks == yourTasks // false
class Pancake { }
let breakfast = Stack(items: [Pancake(), Pancake()])
let lunch = Stack(items: [Pancake()])
breakfast == lunch // operator function '==' requires that 'Pancake' conform to 'Equatable'