we know that
John can paint a fence in 9 hours
so
100%----------> 9 hours
X--------------> 1 hour
x=100/9-----> 11.11%
that means that in 1 hour john paint 11.11% of the fence
Tim can paint a fence in 11 hours
so
100%----------> 11 hours
X--------------> 1 hour
x=100/11-----> 9.09%
that means that in 1 hour Tim paint 9.09% of the fence
John and Tim in 1 hour can paint (11.11%+9.09%)-----> 20.2 %
so
20.2%---------> 1 hour
100%--------> X
x=100/20.2-----> x=4.95 hours
the answer is
4.95 hours