Navan interview question

similar to pascal triangle with recursion and optimization