Explain the algorithm of csum array

explain the algorithm behind the csum loop for printing sum with their respective indices

hi @prajwalsingh226_b93d74431f6edd96,
suppose array is [1,2,3,4,5];
csum array will be [1,3,6,11,15]

now you want to calculate between any 2 points say index = 2 and index = 4
so ans will be csum[4] - csum[2-1] = 15-3 = 12 which is sum of (3+4+5) in o(1) time

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.