Answer
$L=\dfrac {kx^{2}}{2m\sin \theta }\approx 3,4m$
Work Step by Step
Lets calculate spring constant of the spring: $k=\dfrac {\Delta F}{\Delta x}=\dfrac {270N}{2\times 10^{-2}m}=135\times 10^{2}\dfrac {N}{m}(1)$ So when block compresses the spring ( which is initially relaxed) it stores potential energy in spring which is calculated by $E_{p}=\dfrac {kx^{2}}{2}\left( 2\right) $ So initial total energy and total energy after comressing spring will be the same ( total energy of the spring block system is conserved) So :$ E_{tot}=E_{po}+E_{ko}=E_{p1}+E_{k1}\Rightarrow E_{po}+0=E_{p1}+0(3)$ since kinetic energy initially and after compressing spring are zero so From (2) and (3) we get $E_{po}=\dfrac {kx^{2}}{2}\Rightarrow mgh_{0}=\dfrac {kx^{2}}{2}\Rightarrow h_{0}=\dfrac {kx^{2}}{2m}\approx 1.7m(4)$ The relation between distance block traveled (L) and $h_{0}$ is $L\sin \theta =h_{0}\left( 5\right) $ From(4) and (5) we get: $L=\dfrac {kx^{2}}{2m\sin \theta }\approx 3,4m$