Prefix sum or for fixed range summation

https://codeforces.com/problemset/problem/433/B
https://codeforces.com/problemset/problem/313/B

DP catagory solution where accumulate sum not possible in this kind of problem because of test cases and time limit.So if we do sum and insert it in an array previously,just use a vector and subtract from upper trange to lower range we'll get the answer.

Comments

Popular posts from this blog

C++ STL practice problem link

Binary Index Tree(BIT)

Combinatorics