Problem, as an interviewer would state it:
"Implement a Set-like class from scratch using an actual hash table — an array of 'buckets', each holding a list of values that hash to the same slot — supporting add, has, and delete."
Examples:
const set = new HashSet();
set.add("apple").add("banana");
set.has("apple"); // true
Clarifying questions expected:
- How should hash COLLISIONS (two different values landing in the same bucket) be handled?
- Does adding an already-present value need to be a genuine no-op, matching real Set semantics?
- Is a fixed bucket count acceptable, or should the table resize as it grows?
Code / implementation expected: Yes — real, direct proof of correct add/has/delete, PLUS a deliberately forced real collision scenario confirming multiple colliding values remain correctly, independently trackable.