1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| public class ListNode { public var val: Int public var next: ListNode? public init() { self.val = 0; self.next = nil } public init(_ val: Int) { self.val = val; self.next = nil } public init(_ val: Int, _ next: ListNode?) { self.val = val; self.next = next } }
extension ListNode: Equatable { public static func == (l: ListNode, r: ListNode) -> Bool { return l === r } }
extension ListNode: Hashable { public func hash(into hasher: inout Hasher) { hasher.combine(ObjectIdentifier(self)) } }
|