Agoda interview question

Leet code Hash Map problem