IUPAC nomenclature query The given compound is: $\ce{CH3-CH2-CH2-CH(CH3)-CH(CH2CH3)-CH2-CH2-CH3}$

The IUPAC name I came up with was 4-ethyl-5-methyloctane but the given answer states 5-ethyl-4-methyloctane.

Are both acceptable? Is there any rule I'm missing out on? I went through the rules but couldn't find the appropriate rule.
Your name is correct, while the given one is not. When the set of locants for subsituents would be the same no matter what, you would assign the lowest locant to the substituent that appears first in the name, which, by alphabetical order, it would be the ethyl group in this case. Hence 4-ethyl-5-methyloctane is the right name.