// assigns next number in currentCandidateList to x,y, returns success/failure
 bool assign(int x, int y) {
   int toBeAssigned = nextCandidate(x, y);
   //printf("next candidate found to be %i\n", toBeAssigned);
   if (toBeAssigned == -1) {
     return false;
   }
   else {
     sudoku[x][y] = toBeAssigned;
     return true;
   }
 }
Interval shortestClosure(const vector<T>& haystack,
                         const vector<T>& needles) {

    Interval shortest(0, haystack.size() - 1);
    LocationLists locLists = buildLocationLists(haystack, needles);
    for (;;) {
        Interval candidate = nextCandidate(locLists);
        if (!candidate.valid()) {
            break;
        }
        if (candidate.length() < shortest.length()) {
            shortest = candidate;
        }
    }
    return shortest;
}