Show that exists a function not increasing $f:(a,b)\rightarrow\mathbb{R}$ that is continuous only over $(a,b)\setminus D$ 
Let $D$ a infinity countable subset of $(a,b)$. Show that exists a function not increasing $f:(a,b)\rightarrow\mathbb{R}$ that is continuous only over $(a,b)\setminus D$

This is an exercise of my course of Measure and Integration. The next exercise is to show there is a function not increasing over $[0,1]$ that is continuous only over the $[0,1]\setminus\mathbb{Q}$ and I'm thinking that the first exercise is a more geral approach. I'm right or there is two versions of the same exercise? 
I know how to solve the second (the example to solve), but I'm not convinced that the first exercise is the same thing. If the first is a more geral approach, I need help how to solve this.
 A: You can use the theorem saying that if $F$ is a $F_{\sigma}$ set, then there exists some function $f$ with $D(f)=F$, where $D(f)$ denotes to the set of discoutinuous points. For the non-increasing part, you can consider $-v(x)=-V_{a}^{x}f$, the negative of variation function. $v(x)$ is continous at a point $x$ if and only if $f$ is continuous at that point. So $D(-v)=D(f)=F$.
A: Enumerate the set $D = \{d_1, d_2, d_3, \ldots\}$, and define
$$
f(x) =
\left\{
\begin{array}{cl}
1/i & \text{if } x = d_i \in D \\
0 & \text{otherwise}
\end{array}
\right.
$$
Clearly, $f$ is discontinuous at points in $D$.  Now consider $x \not \in D$, and fix $\epsilon > 0$.
There are only finitely many points $d_i$ such that $\frac{1}{i} \ge \epsilon$; therefore, we can find $\delta > 0$ such that none of the finitely many points lie in $(x - \delta, x + \delta)$.  This implies $|f(y) - f(x)| < \epsilon$ whenever $|x - y| < \delta$.
To choose $\delta$, let
\begin{align*}
D_1 = \left\{ d_i \; \Big| \; \frac{1}{i} \ge \epsilon, d_i < x \right\}
D_2 = \left\{ d_i \; \Big| \; \frac{1}{i} \ge \epsilon, d_i > x \right\}
\end{align*}
Then $D_1$ and $D_2$ are finite, which means
they have minimum and maximum elements.
We have $\max D_1 < x$ and $\min D_2 > x$.
Let $\delta = \min(x - \max D_1, \min D_2 - x)$.
Show that $(x - \delta, x + \delta)$ is entirely disjoint from the sets $D_1$ and $D_2$.
Conclude that for all $d_i \in (x - \delta, x + \delta)$, 
$\frac{1}{i} < \epsilon$, i.e., $f(d_i) < \epsilon$.
Therefore, for all $y \in (x - \delta, x + \delta)$, $|f(x) - f(y)| < \epsilon$.

The above answer is not great because I forgot that $f$ has to be monotone.
A better answer:
In the same vein as your solution mentioned in the comments, let
$D = \{d_1, d_2, d_3, \ldots\}$, and define
$$
f(x) = \sum_{d_i < x} \frac{1}{i^2}
$$
Then you can do the exact same solution you did in the case that $D$ is the rational numbers.
