IBM interview question

cool greedy and hash map