Pregunta de entrevista de Huawei Technologies

technical question. how to do some recursive function in a specific scenario