DoorDash Interview Question

LC hard Tree sum max