Amazon Interview Question

First question was based on the binary search Second was a DP problem with binary tree.