Jeavio Interview Question

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