Solving Problems by Subproblem Classification