How does market mechanism work to solve the basic problems in a free market eocnomy?

how does the market mechanism solve the basic problem of free market economy?