DoorDash interview question

very similar to basic calculator II