Pergunta de entrevista da empresa Amazon

The two coding problems are not hard at all. Both are can be solved with binary search, it's a bit redundant.