Interesting question. 

Here's an alternative approach using a symmetrical relationship involving launch and terminal velocities that I found, which helps simplify the solution. 


$\hspace{4cm}$[![enter image description here][1]][1]


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](https://math.stackexchange.com/q/2660468/168053) 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 or calculus. 


  [1]: https://i.sstatic.net/QDalSm.jpg