The problem is kind of hard to solve if one is not careful. One can write the satisfying equations but still might not be able to find the answer. I will outline a way to this.
The idea is that at the minimum required velocity the projectile just touches the top of the walls. Let the velocity and angle of projection at the origin be $v_0$ and $\theta _0$. From the origin the projectile goes and touches the top of the first wall. You can view the rest of its motion as a projectile projected from the top of the first wall with velocity $v_1$ at an angle $\theta_1$(both are unknown at this point). The following relation holds $$ v_1 ^2 = v_0 ^2 -2gh_1.$$ Define $\sin(\phi) = \frac{h_2 - h_1}{L}$. The projectile should now go and touch the top of the second wall which means w.r.t the new origin it must pass through the point $(L cos(\phi), h_2 - h_1)$. You can plug this in to the equation of projectile parabola to get.
$$h_2 - h_1 = \tan(\theta_1)(L\cos(\phi)) - \frac{gL^2\cos^2(\phi)}{2(v_0^2 -2gh_1)\cos^2(\theta_1)}$$$$h_2 - h_1 = \tan(\theta_1)[L\cos(\phi)] - \frac{gL^2\cos^2(\phi)}{2(v_0^2 -2gh_1)\cos^2(\theta_1)}$$.
Now rearrange this and write $v_0$ in terms of $\theta_1$. Everything else are parameters given in the question. Use calculus to minimize the value of $v_0$. You'll get the answer. Let me know if anything is not clear.