Pergunta de entrevista da empresa DoorDash

Leetcode tagged question - medium and hard difficulty.