We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c5f923d commit 7ec1facCopy full SHA for 7ec1fac
content/3_Silver/Prefix_Sums.mdx
@@ -270,9 +270,6 @@ public class Main {
270
<PySection>
271
272
```py
273
-# import itertools
274
-
275
276
def psum(a):
277
psum = [0]
278
for i in a:
@@ -290,9 +287,8 @@ for i in range(Q):
290
287
```
291
288
292
289
An alternative approach is to use [`itertools.accumulate`](https://docs.python.org/3/library/itertools.html#itertools.accumulate).
293
294
-The first value returned is that of the iterable passed, so we add a zero in the front.
295
-Note that in newer versions you can give the optional parameter `initial=0`.
+Notice that we need to add a $0$ to the front of the array.
+If using a newer version, you can use the optional parameter `initial=0` as well.
296
297
298
import itertools
0 commit comments