Pergunta de entrevista da empresa Garmin

there was a leetcode easy problem