Answer:As most maths problems, you don’t have to convert it immediately in numbers to solve it.
It’s obvious that John works twice as fast as Tom to paint the same surface. It means that if they work simultaneously, at any time John will always have painted twice as much surface as Tom. So if they plan it properly and they end the painting of the room at the same time, John will have painted twice as much surface as Tom.
There is only one possibility : if Tom painted 1/3 of the room and John painted 2/3.
Now, if Tom painted 1/3 of the room it probably took him 1/3 of the time needed to paint the entire room, or 12/3=4 hours. It also works for John : 6*2/3=4 hours
Explanation: