C
C#•2w ago
Gargantua

Design Hashset

Running into some problems on this Leetcode exercise, I don't know what's wrong though
No description
No description
No description
3 Replies
tera
tera•2w ago
maybe input has values larger than 1000? 😄
SleepWellPupper
SleepWellPupper•2w ago
Isolate the test inputs your set is failing for and it may become clearer. My guess is your hash function is bad (it is) You're failing on only 6 tests, I'm betting that you have collisions where adding a overwrites b another and a subsequent Contains(a) thus yields false
SleepWellPupper
SleepWellPupper•2w ago
Hash table
In computing, a hash table is a data structure that implements an associative array, also called a dictionary or simply map, which is an abstract data type that maps keys to values. A hash table uses a hash function to compute an index, also called a hash code, into an array of buckets or slots, from which the desired value can be found. During ...
Want results from more Discord servers?
Add your server
More Posts