Pregunta de entrevista de Amazon

2 difficult recursive/dynamic programming type questions on hackerrank