Heat extracted by ice at 0oC to melt = Heat given by water to reach 0oC from 40oC.
ML=mcθ
Where, θ = change in temperature of water
L = Specific Latent heat of ice
c = Specific heat capacity of water
M = Mass of ice required
m = mass of water
M×336=300×4.2×(40−0)
M=300×4.2×40336=150g
∴ Ice required to lower the temperature of water =150g