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$. Conservation of energy gives $$\begin{align} v^2&=u^2-2gh_1\tag{A}\\ w^2&=u^2-2gh_2\tag{B}\end{align}$$ Putting these into equation $(1)$ [here](https://math.stackexchange.com/q/2660468/168053) for minimum velocities (and omitting $^*$ for minimum velocities for clarity of notation), we have $$\begin{align} vw&=gk\\ 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)+4gh_1h_2&=g^2L^2-g^2(h_2^2-2h_1h_2+h_1^2)\\ u^4-2g(h_1+h_2)+g^2(h_1^2+2h_1h_2+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.