Let the speed of the stream be x km/hr
Speed of the boat in still water = 18 km/hr
Speed of the boat in upstream = (18-x) km/hr
Speed of the boat in downstream = (18+x) km/hr
Distance between the places is 24 km.
Time to travel in upstream = 24/(18-x) hr
Time to travel in downstream = 24/(18+x) hr
Difference between timings = 1 hr
Time of upstream journey = Time of downstream journey + 1 hr
Therefore, 24/(18-x) = 24/(18+x) + 1
=> 24/(18-x) - 24/(18+x) = 1
=> 24(18+x) - 24(18-x) / (18-x)(18+x) = 1
=> 432 + 24x - 432 + 24x / (324 - x^2) = 1
=> 48x = 324 - x^2
=> x^2 + 48x - 324 = 0
=> x^2 + 54x - 6x - 324 = 0
=> x(x+54) - 6(x+54) = 0
=> (x+54)(x-6) = 0
So, x = -54 or 6
(speed of the stream cannot be negative)
Therefore, speed of stream is 6 km/hr.