Hopper interview question

Some HackerRank question about messaging data structure