Pregunta de entrevista de DoorDash

Two leetcode medium to hards.