Your answer is correct.
For an arithmetic solution, in the first case, assume the grass is let grow for $4$ days, then the initial grass and the grass accumulated over $4$ days is equal to $36*4$ or $144$ cow-days. Similarly, in the second case, the initial grass and the grass accumulated over $9$ days is equal to $189$ cow-days. The difference between these two cases is the grass accumulated over $5$ days which is equal to $(189-144)$ or $45$ cow-days. That means, the grass accumulation per day is equal to $9$ cow-days.
Take the first case. The grass accumulated for $4$ days is equal to $36$ cow-days. Since the initial grass and the grass accumulated over $4$ days is equal to $144$ cow-days, the initial grass is equal to $(144-36)$ or $108$ cow-days.
Now, to find the answer to the question: in $18$ days, the grass accumulation is equal to $18*9$ or $162$ cow-days. Adding the initial amount of $108$ cow-days, the amount at the end of $18$ days is equal to $270$ cow-days. Divide $18$ into $270$ to find the number of cows, which is $15$.
By the way, even algebraically, a simpler solution is:
Assume $I$ is the initial grass and the growth for day is $d$.
$I+4d= 144$
$I+9d= 189$
From these two,
$d=9, I=108$
If $m$ cows can be fed for $18$ days,
$108+18*9= 18m$
which gives $m=15$