Pergunta de entrevista da empresa CIMON

Asked me to solve a leetcode easy question