Pergunta de entrevista da empresa General Motors (GM)

LeetCode Hard question number #1044.