Implemented half of the validatePuzzle function.