Relation of 12 inch candle height h with time t hours is :
h = 12 - 0.5t
Also, for 18 inch candle :
h = 18 - 2t
Let, after x hours height is same.
So,
[tex]12-0.5x = 18 - 2x\\\\1.5x = 6\\\\x=4\ hours[/tex]
So, after 4 hours height of the candles will be same.
Hence, this is the required solution.