Pergunta de entrevista da empresa General Motors (GM)

Solve this leetcode easy problem