|
0
I don't think this is a correct solution. (or maybe I misinterpreted it) If I have an array [0,2,4,0] and I want to query (1,4), this solution will yield 10 as answer. (while the answer should be 4) |
|
+88
|
|
+28
|
|
+7
I like the second meme. |
|
-45
Very helpful. Thanks. |
|
0
Let Ai (1<=i<=N) equals 10^9, N equals 200000, and K equals N-1. Therefore the grade for each term will be 1000000000^199999. Absolutely overflow. |