Given the hourly laws of the minute and hour hands:
$$ \theta_m = \omega_m\,t\,, \quad \quad \quad \theta_h = \omega_h\,t $$
with $\omega_m = \dfrac{2\pi}{60 \cdot 60 \,s}$ and $\omega_h = \dfrac{2\pi}{60 \cdot 60 \cdot 12 \,s}$, to determine the times in which the two hands form a $\pi/2$ angle it's sufficient to impose:
$$ \omega_m\,t - \omega_h\,t = \frac{\pi}{2} + k\,\pi $$
with $k \in \mathbb{Z}$, that is by calculating:
$$ t = \frac{\frac{\pi}{2} + k\,\pi}{\omega_m - \omega_h} $$
with $k = 0,\,1,\,\dots,\,21$ we can get all $22$ times at which the hands make an angle of $\pi/2$ over a $12$ hour time span.
And so far everything is ok.
At this point, if instead of $\pi/2$ we consider any angle, how is it possible to list the $22$ times in which this angle occurs?
If you are looking for a separation of $\pm \theta$ for a general angle $\theta$, the simplest approach is to split into two cases. For a separation of $\theta$ there are $11$ times when
$$0 \le \theta +2n\pi \lt 22\pi$$
and the interval between two successive occurrences is $\frac {12}{11}$ hours. There are another $11$ occurrences when the separation is $-\theta$, making $22$ occurrences altogether in a $12$ hour period.
For $\theta=0$ and $\theta=\pi$ the cases for $\theta$ and $-\theta$ merge so you only have $11$ occurrences in $12$ hours.