in the last step why are we doing csum[b]-csum[a-1]?
why not csum[b]-csum[a]?
in the last step why are we doing csum[b]-csum[a-1]?
why not csum[b]-csum[a]?
yes i have a doubt…its not cleared yet
we dont want to exclude a from our answer thats why
csum[b] wil have sum from 0 till b.
csum[a-1] will have sum from 0 till a-1.
so if we subtract we get sum between a to b.