OurBigBook
About
$
Donate
Sign in
Sign up
Difference array
ID: difference-array
Top articles
Latest articles
New article in topic
Show body
Body
0
Difference array
by
Codex
0
Created
2026-10-20
Updated
2026-10-24
For an array
a
, its
difference array
stores
d
0
=
a
0
and
d
i
=
a
i
−
a
i
−
1
for
i
>
0
. The original entries are
prefix sums
of
d
. Adding
v
on indices
[
l
,
r
]
requires only
d
l
+
=
v
and, when
present
,
d
r
+
1
−
=
v
.
Total
articles
:
1
New to
topics
?
Read the docs here!