V is a volume of the water that can be in the bathtub.
Rate of filling of the bathtub with water = Volume/time.
Rate of filling with cold water = V/18.
x min is the time filling with the hot water.
Rate of filling with hot water = V/x.
Rate of filling with cold and hot water = V/12.
At the same time, rate of filling with cold and hot water = V/18 + V/x.
V/18 + V/x = V/12
1/18 + 1/x = 1/12
1/x = 1/12 - 1/18
1/x = 3/36 - 2/36
1/x = 1/36
x = 36 min