How to update a range of a segment tree from indices i to j when the values added are in an Arithmetic Progression?

I want to solve a problem which asks to update a range from indices i to j with value p as…
… and so on till jth index.
How can I do it using a segment tree?

1 Like