Pergunta de entrevista da empresa Walmart

A 45 minutes coding question (standard stack question)