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

Function Constructor

go/0706-design-hashmap.go:18–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16}
17
18func Constructor() MyHashMap {
19 var arr []*Node
20 for i := 0; i < 512; i++ {
21 arr = append(arr, NewNode(-1, -1))
22 }
23 return MyHashMap{
24 Array: arr,
25 }
26}
27
28func (this *MyHashMap) hash(key int) int {
29 return key % len(this.Array)

Callers

nothing calls this directly

Calls 1

NewNodeFunction · 0.70

Tested by

no test coverage detected