Bloomberg interview question

Question about tree implementation, and a dp problem