Pergunta de entrevista da empresa Rocksbox

Very reasonable and practical coding problem.