What is a hash table and how are collisions resolved?
The gist
A hash table stores key–value pairs in an array of buckets. The bucket index is computed from the key: hash(key) % capacity. This gives average O(1) lookup, insertion and removal — given a good hash function and a moderate load factor (elements / buckets).
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep