Pregunta de entrevista de HackerRank

A DP problem and a binary tree problem