Given the four factors, we can assume the period of the pendulum to be $[t] = [kl^a m^b g^c \theta^d]$, where $a,b,c,d$ are unknown real numbers.

However, $\theta$ is dimensionless, and $k$ is a constant that is assumed to be dimensionless as well, so we get: $T= L^a M^b (LT^{-1})^c$

Equating the powers of $M, L$ and $T$ on both sides of $[t] = T$, we get:

$L: 0 = a+c, M:0=b, T:1=-2c \rightarrow b=0, c = \large\frac{-1}{2}$$, a = -c = \large\frac{1}{2}$

$\Rightarrow t = kl^{\large\frac{1}{2}} g^{\large\frac{-1}{2}} \theta^d$ (d is unresolved and can assume any value)

$\Rightarrow$ The general result is: $t = f(\theta)l^{\large\frac{1}{2}} g^{\large\frac{-1}{2}}$