Pergunta de entrevista da empresa Shop Bonsai

One typical algorithm question and logic problems.