Interesting question.
Here's an alternative approach using a symmetrical relationship involving launch and end velocities that I found, which helps simplify the solution.
Let $u,v,w$ be velocities at launch, at the first wall and at the second wall respectively. Let $k$ be the horizontal distance between the two walls. Hence $k^2=L^2-(h_2-h_1)^2$.
Squaring equation $(1)$ here for minimum velocities (and omitting $^*$ for minimum velocities for clarity of notation) and using the standard $V^2=U^2+2AS$ formula gives
$$\begin{align} v^2w^2&=g^2k^2\\ (u^2-2gh_1)(u^2-2gh_2)&=g^2 \big(L^2-(h_2-h_1)^2\big)\\ u^4-2g(h_1+h_2)u^2+4gh_1h_2+g^2(h_2-h_1)^2&=g^2L^2\\ u^4-2g(h_1+h_2)u^2+g^2(h_1+h_2)^2&=g^2L^2\\ \big(u^2-g(h_1+h_2)\big)^2&=g^2L^2\\ u^2-g(h_1+h_2)&=gL\\ \text{Minimum launch velocity, }\;\;\;\;\;\;\color{red}u&\color{red}{=\sqrt{g(h_1+h_2+L)}} \end{align}$$
No trigonometric ratios required.