Pergunta de entrevista da empresa Cloudera

a difficult leetcode medium problem