My solution to HackerRank.com problem IceCream Parlour