Pergunta de entrevista da empresa IBM

Go do a leetcode medium and that sums it up.