# construction of polynomial by using runge approximation theorem

I have given exercise related to application of "Runge's Approximation Theorem" stated as "If $f$ is holomorphic on neighborhood of compact set $K$ it can be approximated by a sequence of polynomials."

The exercise is to construct a sequence of polynomial such that

$P_n(z) \to 1$ on $\operatorname{Im}(z)>0$ ,

$P_n(z) \to -1$ on $\operatorname{Im}(z)<0$ and $P_n(z) \to 0$ on $\mathbb{R}$

Please give me some idea how to find compact set for such kind of construction. I will be very grateful for it.

The idea is to choose a sequence of compact sets exhausting $\mathbb{C}$.
For example, let \begin{align} A_n &= \{ z = x+iy \in \mathbb{C} : \frac1n \le y \le n, -n \le x \le n \} \\ B_n &= \{ z = x+iy \in \mathbb{C} : -\frac1n \ge y \ge -n, -n \le x \le n \} \\ C_n &= \{ z = x+iy \in \mathbb{C} : \frac1n \le y \le n, x=0 \}, \end{align} and put $K_n = A_n \cup B_n \cup C_n$. Then the complement of $K_n$ is connected, and the function $$f_n(z) = \begin{cases} 1, &\text{on a neighbourhood of A_n} \\ -1, &\text{on a neighbourhood of B_n} \\ 0, &\text{on a neighbourhood of C_n} \end{cases}$$ is holomorphic on a neighborhood of $K_n$ (choose the neighborhoods i the definition of $f_n$ small enough so they won't overlap).
Runge's theorem gives you a polynomial $p_n$ such that $|p_n - f_n| \le \frac1n$ on $K_n$. Let $n \to \infty$. (Note that for every fixed $z \in \mathbb{C}$, $z \in K_n$ if $n$ is large enough.)