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

Method Remove

go/0706-design-hashmap.go:55–63  ·  view source on GitHub ↗
(key int)

Source from the content-addressed store, hash-verified

53}
54
55func (this *MyHashMap) Remove(key int) {
56 cur := this.Array[this.hash(key)]
57 for cur.Next != nil && cur.Next.Key != key {
58 cur = cur.Next
59 }
60 if cur != nil && cur.Next != nil {
61 cur.Next = cur.Next.Next
62 }
63}
64
65/**
66 * Your MyHashMap object will be instantiated and called as such:

Callers

nothing calls this directly

Calls 1

hashMethod · 0.95

Tested by

no test coverage detected