Multiples of 3

,

solution: CodeChef: Practical coding for everyone

why is iy coming wrong answer again and again plz someone help

consider a simple test case

4 2

0 2 3

1 2 2

ans should be 0 but ur code gives 1

since when u have updated the values for a complete segment & return it(line 36-40)…values for child nodes are not being updated dats why in above case also node 3 is updated but not node 6 & 7.

https://www.codechef.com/viewsolution/30953032
What is wrong in this approach…Can someone help??

hi were you able to solve this problem?