Domanda di colloquio di Jeavio

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