Practice: Collections & Generics Drill
50 min · Intermediate
Collections rounds mix four kinds of questions: "which collection would you use?", predict-the-output snippets, short coding problems, and "explain how it works inside". This drill gives you a fast method for each kind and a full set of practice to run against the clock.
Topics in this lesson
- Which collection would you use? A four-question method
- Predict the output: maps, sets and iterators
- Coding questions: word frequency, first non-repeating character, group anagrams
- Explain-the-internals round
Interview questions this lesson answers
- Which collection would you use to store unique email IDs in sign-up order?
- Which collection would you use for a leaderboard that must stay sorted by score?
- Which collection would you use to process print jobs in arrival order?
- Which collection would you use to always get the nearest deadline first?
- Which collection for a cache that drops the least recently used entry?
- Which collection for a phone directory searched by name prefix?
- Which collection when many threads update counters by key?
- Explain how ArrayList grows, in one breath.
- Explain HashMap put in one breath.
- Explain HashSet in one breath.
Sign in free to continue this lesson
Create a free account to read every lesson, practise with the exercises and keep track of your progress.