[Solved] Competitive programming: “Time exceeded error”
[ad_1] Calculate the cumulative sum of the array and store it in another one, that is to say, accumulated[i] = sum of numbers of the array up to ith index. This can be computed in O(n). Then for a query, the answer will be accumulated[r] – accumulated[l]. This is O(1) [ad_2] solved Competitive programming: “Time … Read more