MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / get

Method get

python/0706-design-hashmap.py:23–29  ·  view source on GitHub ↗
(self, key: int)

Source from the content-addressed store, hash-verified

21 cur.next = ListNode(key, value)
22
23 def get(self, key: int) -> int:
24 cur = self.map[self.hashcode(key)].next
25 while cur and cur.key != key:
26 cur = cur.next
27 if cur:
28 return cur.val
29 return -1
30
31 def remove(self, key: int) -> None:
32 cur = self.map[self.hashcode(key)]

Callers

nothing calls this directly

Calls 1

hashcodeMethod · 0.95

Tested by

no test coverage detected