Pregunta de entrevista de Amazon

Two algorithm problems average medium difficulty