Pregunta de entrevista de Amazon

Leetcode questions. Both medium. One binary search based and one tree based.