Skip to content

Commit 7ec1fac

Browse files
Update Prefix_Sums.mdx
1 parent c5f923d commit 7ec1fac

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

content/3_Silver/Prefix_Sums.mdx

+2-6
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,6 @@ public class Main {
270270
<PySection>
271271
272272
```py
273-
# import itertools
274-
275-
276273
def psum(a):
277274
psum = [0]
278275
for i in a:
@@ -290,9 +287,8 @@ for i in range(Q):
290287
```
291288
292289
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`.
290+
Notice that we need to add a $0$ to the front of the array.
291+
If using a newer version, you can use the optional parameter `initial=0` as well.
296292
297293
```py
298294
import itertools

0 commit comments

Comments
 (0)