Pergunta de entrevista da empresa Amazon

Two algorithm problems average medium difficulty