Returns the value to which the specified key is mapped, or -1 if this map contains no mapping for the key :type key: int :rtype: int
(self, key)
| 25 | prev.next.val = value |
| 26 | |
| 27 | def get(self, key): |
| 28 | """ |
| 29 | Returns the value to which the specified key is mapped, or -1 if this map contains no mapping for the key |
| 30 | :type key: int |
| 31 | :rtype: int |
| 32 | """ |
| 33 | index = hash(key) % self.size |
| 34 | if self.nodes[index] is None: |
| 35 | return -1 |
| 36 | prev = find(self.nodes[index], key) |
| 37 | if prev.next is None: |
| 38 | return -1 |
| 39 | else: |
| 40 | return prev.next.val |
| 41 | |
| 42 | def remove(self, key): |
| 43 | """ |