There seem two probable approaches to the question but both of them yield different results. Both seem to be mathematically correct and hence the confusion.
We know that,
Integrating the above expression we get:
Using the above property to solve the integration we get the answer as
We can write
But assumes constant values of and in the respective intervals. And hence in both cases and therefore
I genuinely can't understand what's the correct method. I will really be grateful if someone can explain it to me.