DoorDash Interview Question

LC Medium problem plus follow ups on edge cases