AMD Interview Question

Hashmap + ArrayList based DSA question with 2 follow-ups