Can You Please provide hint for this one?

Can You Please provide hint for this one?

hello @cbcao263

Just see number of times every position occurs in all the odd length subarray.
Multiply the contribution of position with element at that position.

How to calculate contribution?
Every element will contribute size of array to its right (n-i) * size of array to its left(i+1)
Since here we only consider odd length divide it by two (ceil divison)


Example 
Given array: arr = [1, 2, 3, 4, 5] (n = 5) and formula (i + 1) * (n - i)
i = 0, contribution = 1 * 5 = 5
i = 1, contribution = 2 * 4 = 8
i = 2, contribution = 3 * 3 = 9
i = 3, contribution = 4 * 2 = 8
i = 4, contribution = 5 * 1 = 5

Bro aise kehrhe.
Thoda ans galt aarha

Bro Aapne Contribution kaise calculate kiye
kaise socha iske baare mein.

Nd Second method bhi hain koi?
Like WindowSliding se

maine aise kaafi question solve kiye hue hain .

u missed this.

Bro ans/2 hi return kiya mene.
Ceil Division means upper leke krna hoga?

@cbcao263
image
take ceil at this position

yes

Farak nhi padrha
Bro vaise ceil function se kyu farak pdega.

wo ton like tab hota na jab floating vgerah ka kuch issue hota.
Here we are directly multiplying 2 numbers.

@cbcao263

check now->

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.