Pregunta de entrevista de ByteDance

Algorithm question was related to recursion