Pregunta de entrevista de BlackRock

DP and recursion based coding problem