Pergunta de entrevista da empresa Intel Corporation

a typical leetcode question.