This problem is about recurrence relations , and reducing it to find a simple formula to find the sum from L to R in each query in Log(n) time.
If you guys find this helpful , please help me grow. Like , comment and subscribe to my channel.
Thank you and keep coding.