Jeavio interview question

First question was based on binary search, second was DP problem