Pregunta de entrevista de Jeavio

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