Finds a solution to the hospital-residency matching problem.