calculate cumulative sum of array cArray [ 0 ] will store sum of zero elements
cArray = [ 0 for i in range ( n + 1 ) ] NEW_LINE for i in range ( 0 , n , 1 ) : NEW_LINE INDENT cArray [ i + 1 ] = cArray [ i ] + arr [ i ] NEW_LINE DEDENT subArrSum = [ ] NEW_LINE