defput(self, key: int, value: int) -> None: index = self.hash(key)
if self.maps[index] isNone: self.maps[index] = ListNode(key, value) else: current = self.maps[index] whileTrue: if current.key == key: current.value = value break elif current.next isNone: current.next = ListNode(key, value) break current = current.next
defget(self, key: int) -> int: index = self.hash(key) current = self.maps[index] while current: if current.key == key: return current.value current = current.next return-1
defremove(self, key: int) -> None: index = self.hash(key) current = self.maps[index] if current isnotNoneand current.key == key: self.maps[index] = current.next else: while current: if current.key == key: pre.next = current.next break pre = current current = current.next