Corrections
This commit is contained in:
parent
32659fe3d2
commit
8efa0efdb2
|
@ -402,14 +402,14 @@ there will be three steps:
|
||||||
the left endpoint moves one step to the left,
|
the left endpoint moves one step to the left,
|
||||||
and the right endpoint moves two steps to the right.
|
and the right endpoint moves two steps to the right.
|
||||||
|
|
||||||
After each step, we update the
|
After each step, the array \texttt{c}
|
||||||
array \texttt{c}.
|
needs to be updated.
|
||||||
After adding an element $x$,
|
After adding an element $x$,
|
||||||
we increase the value of
|
we increase the value of
|
||||||
$\texttt{c}[x]$ by one
|
$\texttt{c}[x]$ by one
|
||||||
and if $\texttt{c}[x]=1$ after this,
|
and if $\texttt{c}[x]=1$ after this,
|
||||||
we also increase the answer to the query by one.
|
we also increase the answer to the query by one.
|
||||||
In a similar way, after removing an element $x$,
|
Similarly, after removing an element $x$,
|
||||||
we decrease the value of
|
we decrease the value of
|
||||||
$\texttt{c}[x]$ by one
|
$\texttt{c}[x]$ by one
|
||||||
and if $\texttt{c}[x]=0$ after this,
|
and if $\texttt{c}[x]=0$ after this,
|
||||||
|
|
Loading…
Reference in New Issue