Coinbase interview question

Easy to medium HackerRank question