Pergunta de entrevista da empresa Tencent

Algorithm Problem Solving at the end.