How does a HashMap work internally? What happens when you call put?
~4 min by voice
How to approach it
The interviewer checks whether the candidate understands how a HashMap works internally: an array of buckets, computing the index from hashCode, handling collisions with equals, and growing the array. It also matters whether they can explain where O(1) comes from and when that estimate breaks down.
The interviewer will ask this question and listen. Think out loud and ask for a hint if you need one. When you're done, pause or tap “That's my answer”. In about a minute, your score and the points you covered show up here.