Pregunta de entrevista de Dropbox

It was a Leetcode style code challenge.