I would like to stress the strong analogy of the solution found by @Batominovski with finite dimensional linear operators, that can be useful in some other cases either for forecasting the adjoint or "verify" an already found result (please note the quotes around the verb verify).
What is the discrete equivalent of the "antiderivative operator" beginning at $0$ ?
The antiderivative operator can be placed in correspondence with the $(n+1) \times (n+1)$ lower triangular matrix:
$$ (f \mapsto \int_0^x f(s) ds) \ \ \ \ \ \leftrightarrow \ \ \ \ \ \begin{pmatrix}1&0&0&\cdots &0\\
1&1&0&\cdots&0\\
1&1&1&\cdots&0\\
\vdots&\vdots&\vdots &&0\\
1&1&1&\cdots&1\end{pmatrix}$$
which is applied to column vectors whose entries are discretized values $f_0,f_1,f_2, \cdots, f_n$ of generic function $f$ at points
$$0=\tfrac0n, \ \ \tfrac1n, \ \ \tfrac2n, \ \ \cdots \ \ \tfrac{n-1}{n}, \ \ \tfrac{n}n=1.$$
We know that the equivalent of the "adjunction operation" is matrix transposition :
$$\begin{pmatrix}1&1&1&\cdots &1\\
0&1&1&\cdots&1\\
0&0&1&\cdots&1\\
\vdots&\vdots&\vdots &&1\\
0&0&0&\cdots&1\end{pmatrix} \ \ \ \ \ \color{red}{\leftrightarrow} \ \ \ \ \ (f \mapsto \int_x^1 f(t) dt)$$
...
(this correspondence $\color{red}{\leftrightarrow} $ being as intuitive as the first one).
For more, see in particular the second example in this question of mine.