Pergunta de entrevista da empresa DoorDash

Leetcode-style question in the phone screen. The onsite had more real world problems, including a debugging interview where the interviewer kept interrupting to tell me what the bugs were before I was able to find them myself.