HackerRank interview question

Phone number solving question with has map algo