Should person A, the one who identifies the problem, have their name on the patent which person B found a solution for?
Merely identifying a problem does not amount to an invention. Person A is not an inventor unless they actually contributed to the solution to the problem. Person B is an inventor as they have solved the problem.