Pregunta de entrevista de CoStar Group

two leetcode questions. easy and medium