Implement validateSolution.