Pergunta de entrevista da empresa CoStar Group

two leetcode questions. easy and medium