Pregunta de entrevista de XinAo Gas

Two questions about algorithm question?