Pergunta de entrevista da empresa X

give you one coding problem and tons of follow-ups to make this problem more generalized.