AMD interview question

Hashmap + ArrayList based DSA question with 2 follow-ups