Finding $f$ such that $ \int f = \sum f$

Please see the problem 5 of the given link: http://www.artofproblemsolving.com/Forum/resources.php?c=2&cid=59&year=2005&sid=722231ab4ec5ce280584eb8f24f07656

It asks us to prove that $$\sum\limits_{n=1}^{\infty} \frac{1}{n^n} = \int\limits_{0}^{1} x^{x} \ dx $$

Natural question which one gets by seeing this type of question is, find all continuous functions which satisfy $$\int\limits_{-\infty}^{\infty} f(x) \ dx = \sum\limits_{n= -\infty}^{\infty} f(n)$$


Pick any sequence $f_k, -\infty < k < \infty$ such that $\sum_{n=-\infty}^{\infty} f_n$ exists, and any other two sequences $g_k, h_k, -\infty < k < \infty$ such that $\sum_{n=-\infty}^{\infty} g_n = 0$ and $h_k\rightarrow 0, k\rightarrow \pm \infty$

Put $f(x) = f_k, x = k$ and construct $f(x)$ on non-integer points however you want to satisfy $f(m)=f_m$, $f(m+1)=f_{m+1}$ and $\int_{m}^{m+1} f(x) dx = f_m+g_m$ and $|\int_{m}^{y} f(x) - (y-m)(f_m-g_m) dx| < h_m, y\in (m,m+1)$ for all $m \in \mathbb{Z}$.

This is just as hard as finding all continuous functions on $g$ on $[0,1]$ whose integral is $1$ and $g(0)=0$, $g(1)=1$ and $|\int_0^y g(x)-y| dx < \varepsilon, y\in (0,1)$.

Motivation: When we pick $f_k$, we have fixed values for $f(x)$ on all integers, and also RHS of equality. To satisfy LHS = RHS, we have freedom to construct $f(x)$ however we want on non-integer points between fixed values on integer points since $f(x)$ should be continuous.

When we consider partial sums $\sum_{n=0}^{m} f_n$ and $\int_0^m f(x)dx$, these two can differ but they should have the same limits. This is controlled by sequence $g_n$.
The rest is just technicality to ensure that $\int_{-\infty}^{\infty}f(x)dx$ is indeed defined. Since we choose practically values for $\int_0^m f(x)dx$ we need to ensure that $\int_0^y f(x)dx$ do not 'wiggle' too much between integer points when $m\rightarrow \infty$. This is what we use $h_n$ for.

All given conditions should be sufficient and necessary.