Amazon Interview Question

One question was based on trees and the other on dynamic programming.