Answer
See the detailed answer below.
Work Step by Step
First, we need to sketch the problem, as seen below.
a) The speed of the box just before reaching the rough surface is its speed at the bottom of the incline.
Since the incline is frictionless, then the energy is conserved.
$$E_{top}=E_{bottom}$$
$$
K_{top}+U_{g,top}=K_{bottom}+U_{g,bottom}$$
$$ \frac{1}{2}mv^2_{top}+mgy_{top}=\frac{1}{2}mv^2_{bottom}+mgy_{bottom}$$
We chose the bottom of the incline to be our origin, at which $y=0$. We also know that the box starts from the rest.
So that,
$$ 0+ \color{red}{\bf\not} mgh=\frac{1}{2} \color{red}{\bf\not} mv^2_{bottom}+0$$
Thus,
$$\boxed{v_{bottom}=\sqrt{2gh}}$$
---
b)
Now we know that the energy of the box at the bottom of the left incline is given by $K=\frac{1}{2}mv_{bottom}^2=\frac{1}{2}m(2gh)=\boxed{mgh}$
This box will lose some of this energy due to friction, so we need to find its speed just before it slides up the second frictionless incline.
$$E_{loss}=f_kL=\mu_kF_n L $$
where, by applying Newton's second law, we got the normal force that is given by $F_n=mg$.
Thus,
$$E_{loss} =\boxed{\mu_kmg L} $$
Hence, the box's energy just before it slides up the second incline is given by
$$E_{bottom,2}=K-E_{loss}=mgh-\mu_kmg L\tag 1$$
And its energy at the top point on the second incline is given by
$$E_{top,2}=U_g=mgh_2\tag 2$$
And since the second incline is frictionless, then the energy is conserved. So that (1)=(2).
$$E_{bottom,2}=E_{top,2}$$
$$ \color{red}{\bf\not} m \color{red}{\bf\not} gh-\mu_k \color{red}{\bf\not} m \color{red}{\bf\not} g L= \color{red}{\bf\not} m \color{red}{\bf\not} gh_2$$
Therefore,
$$\boxed{h_2=h-\mu_kL}$$