Preparations for coding interviews
A hash table is a data structure that maps keys to values for efficient lookup.
There are many ways to implement hash tables. The most common is to use an array of a linked lists and a hash code function.
Inserting into map (key and value)
- Compute the key's hash code, which will usually be an int or long. Note that two different keys could have the same hash code, as there may be an infinite number of keys and a finite number of ints.
- Map the hash code to an index in the array. This could be done with something like
hash(key) % array_length. Two different hash codes could, of course, map to the same index (finding a correct bucket).
- At this index, there is a linked list of keys and values. Store the key and value in this index. We must use a linked list because of collisions: you could have two different keys with the same hash code, or two different hash codes that map to the same index.
Retrieving value by its key (key and value)
To retrieve the value by its key, we need to repeat the process.
- Compute the hash code from the key.
- Compute the index from the hash code (find a bucket on picture).
- Search through the linked list for the value with this key. If the number of collisions is very high,
the worst case runtime is
Nis the number of keys. Generally we assume a good implementation that keeps collisions to a minimum, in which case the lookup time is
Note: A bucket is used to store key value pairs. A bucket can have multiple key-value pairs. In hash map, bucket used simple linked list to store objects.
Mock Interview / preparations
|Many free content, but has some premium content for extra money.|
|Mainly paid content, but has some free.|
|Fully paid content.|
Coding Interview University (GitHub)
Coding-interview-university. Good resource, have very long list of advices on what to read and how to prepare for your coding AND System Design interview.
InterviewBit. Self paced tutorial like resource on preparation for coding, system design AND have a mock interview feature. Contains many problems for different companies.
🆓 / 💰
LeetCode. Many challenges, problems for solving. Have a bonus system. You could spend money and buy a premium subscription for mock interviews and premium problems.
💰 / 🆓
InterviewCake. This resource is about coding practice, but it differs from others. The main focus here is to give you a basic intuition on how to address to the particular problem.
System Design Primer (GitHub)
System Design Primer. Great resource on how to deal with system design interviews. Contains different use cases and real world experience. Highly recommend to review it.
HiredInTech Guys are doing great job on advices and use cases for system design interviews. Definitely recommend to spend some time here.
Technical Mock Interview
Technical Mock Interview. The main focus is mock interviews and with detailed
Pricing: $80 per session OR $340 for 5 session package.
Gainlo. The main focus is mock interviews. Also, they have good blog on general advices on how to deal with interviews. Pricing: $50-$130 per interview based on the interviewer, interview type, industry, etc.
System Design Interview
System Design Interview. Very concentrated course. Many use cases, examples.
Highly recommend it before preparation. After a couple of years of design you will definitely find
something new for you.
Pricing: whole course for ~ $79.