DoorDash interview question

2 algorithm questions (back to back)