O(n) solution: Why do we always need to consider the count at i+2?


#1

I m unable to understand the reason why do we need to pick the count at i + 2 when we start to count the result and we land at i-th index of the array which has sum equals to the (sum of array) / 3


#2

we take i+2 because we need to divide it in 3 equal parts and if we will take i+1 as our starting index then if i+1th suffix element is sum/3 then it will just divide the array in two parts having sum as sum/3. thats why we need to leave one space for the third contiguous part .if u still have some doubts then call me at 8887763900 i will explain it to you in detail.