Syrmia interview question

Classic leetcode easy hashmap problem.