Ad
  • Custom User Avatar

    I seem to have a problem where the program asks me to mark a grid that seems valid as invalid, like this one:

    Input:
    [4, 8, 3, 5, 7, 1, 9, 2, 6]
    [2, 7, 9, 4, 8, 6, 3, 5, 1]
    [5, 1, 6, 9, 2, 3, 8, 7, 4]
    [1, 9, 4, 3, 6, 7, 5, 8, 2]
    [3, 6, 7, 2, 5, 8, 1, 4, 9]
    [8, 2, 5, 1, 9, 4, 7, 6, 3]
    [6, 5, 1, 7, 4, 9, 2, 3, 8]
    [9, 4, 2, 8, 3, 5, 6, 1, 7]
    [7, 3, 8, 6, 1, 2, 4, 9, 5]
    --------------------------
    [[4, 8, 3, 5, 7, 1, 9, 2, 6], [2, 7, 9, 4, 8, 6, 3, 5, 1], [5, 1, 6, 9, 2, 3, 8, 7, 4], [1, 9, 4, 3, 6, 7, 5, 8, 2], [3, 6, 7, 2, 5, 8, 1, 4, 9], [8, 2, 5, 1, 9, 4, 7, 6, 3], [6, 5, 1, 7, 4, 9, 2, 3, 8], [9, 4, 2, 8, 3, 5, 6, 1, 7], [7, 3, 8, 6, 1, 2, 4, 9, 5]]
    [[4, 8, 3, 5, 7, 1, 9, 2, 6], [2, 7, 9, 4, 8, 6, 3, 5, 1], [5, 1, 6, 9, 2, 3, 8, 7, 4], [1, 9, 4, 3, 6, 7, 5, 8, 2], [3, 6, 7, 2, 5, 8, 1, 4, 9], [8, 2, 5, 1, 9, 4, 7, 6, 3], [6, 5, 1, 7, 4, 9, 2, 3, 8], [9, 4, 2, 8, 3, 5, 6, 1, 7], [7, 3, 8, 6, 1, 2, 4, 9, 5]]
    there are 1 solutions
    

    I am sure this is simple oversight on my part, as many people have solved this in Python and I don't think that everyone has made a mistake but me. Still, I can't find a reason for why this grid should be invalid. If someone could enlighten me I would be very grateful as I have been working on my solution for a week and would love to finally submit it :).