You have to assume that the hydrocarbon contains only C, H and, possibly, O.
Then, all the C in CO2 and the H in H2O come from the hydrocarbon.
a) Number of moles of C in 23.8 g of CO2.
molar mass of CO2 = 12.0 g + 2 * 16.0 g = 44.0 g / mol
number of moles of C = mass in grams / molar mass = 23.8 g / 44.0 g/mol = 0.5409 mol
b) number of moles of H in 8.11 g of H2O
number of moles = mass in grams / molar mass = 8.11 grams / 18.0 g/mol = 0.4506 mol
c) mass of O in the hydrocarbon, m of O:
m of O = 7.40 g - mass of C - mass of H
mass of C = number of moles * atomic mass = 0.5409 mol * 12 g/mol = 6.49 g
m of H = 0.4506 mol * 1 g /mol = 0.45 g
=> grams of O = 7.40 g - 6.49 g - 0.45 g = 0.46 g of O.
d) number of moles of O = mass / atomic mass
=> number of moles of O = 0.46 g / 16 g / mol = 0.02875 mol O.
e) Empirical formula
C: 0.5409 / 0.02875 = 18.8 ≈ 19
H: 0.4506 / 0.02875 = 15.7 ≈ 16
O: 0.02875 / 0.02875 = 1
=> Empirical formula = C19 H16 O