Pergunta de entrevista da empresa Pocket Gems

Algorithm and Design question