This is an example of a math problem where if you think about it one way you will end up confused and if you think about it another way it will be simple. A lot of problems in mathematics are like this, which is part of what makes mathematics creative.
Person a can build the shed in 4 hours, so he builds 1/4 of it each hour.
Persons a and b working together (with perfect cooperation I assume) can build it in 3 hours, so together they build 1/3 of a shed each hour.
The contribution of person b each hour is therefore 1/3 - 1/4 = 1/12. Person b can build 1/12 of the shed in an hour. Consequently it would take person b 12 hours to build it alone.
I should point out that we had to make some very strange assumptions to make this solution work, and it probably wouldn't work like this in the real world. We assumed that:
1. There was perfect cooperation so that persons a and b did not interfere with each other's contribution in any way.
2. Each person works at a uniform rate, so that the same amount of the project is completed each hour.
Now, suppose these assumptions aren't true. Suppose that person a is faster at some parts of the project and person b is faster than others and working on some parts of the project together would slow them both down.
So it's possible that person b working alone could complete the shed much faster, say in 6 hours, but by doing so he would interfere with person a's work and slow person a down; so he chooses only to work on certain parts of the shed during the 3 hours.
Suppose that person works only on the first third of the project and person a completes the rest. This way, person b could be contributing less than his full potential making the calculation above incorrect.
So assuming that assumption 2 is still true, we could compute that person a takes 4 hours to build the shed and so he builds half of it the last two hours. Person a and person b work together the first hour and complete half the shed which means person a contributed 1/4 of the shed during the first hour and person b also contributed 1/4 of the shed! If person b were to be working alone and could complete 1/4 of the shed the first hour we do not know what he could do alone but he sounds much more competent.
Note: actually I think the first version of this kind of problem was about digging ditches, where it's much easier to cooperate and to satisfy the two assumptions.