Pergunta de entrevista da empresa Amazon

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