I think we ignore air resistance.
When we throw a ball (vertically) with the initial speed `V_0` , the speed at a moment t will be `V(t)=V_0-g*t,` where g is the gravity acceleration (`9.8m/s^2` ).
The height `H(t) = V_0*t - (g*t^2)/2.`
If we want minimum speed, then at the required height a ball should stop, i.e. its speed will be zero.
`V_0 - g*t = 0,` `t = t_0 = V_0/g.`
And the height at` t_0` must be 4m, i.e.
`(V_0*V_0)/(g) - (g*V_0^2/g^2)/2 = 4.`
The left side is equal to `V_0^2/(2g).` So
`V_0^2` = 8g, `V_0 = sqrt(8g) approx` 8.85(m/s).