A case that is not included


  • 3
    D
    .	2	3	4	5	6	7	8	9	
    8	.	.	.	.	.	.	.	.	
    7	.	.	.	.	.	.	.	.	
    6	.	.	.	.	.	.	.	.	
    5	.	.	.	.	.	.	.	.	
    4	.	.	.	.	.	.	.	.	
    3	.	.	.	.	.	.	.	.	
    2	.	.	.	.	.	.	.	.	
    1	.	.	.	.	.	.	.	.
    

    I am sorry I didn't explain it very clearly.

    Obviously, there is no solution to this Sudoku.

    But if our program only tests each row/column and 3x3 block, it will return true. And of course, our program will pass the OJ test.

    I think the solution to this problem is just the same as the problem "Sudoku Solver".


  • 0
    S

    Hi Decheng, could you please explain what is your question? like: this test case get the unexpected result from your solution, but passed the oj? what do you think the result is, and why? you should edit the content to detail your question.


  • 0
    D

    Hi Shangrila, I have updated the question. Sorry for misunderstood.


  • 11
    S

    Valid Sudoku is not same as Sudoku Solver .

    For this problem, all you need to do is following the 3 rules of Sudoku, which you can refer from here, to check if it is a valid state of sudoku, regardless of if there is a solution under this situation.

    However, you provide a great test case that can distinct these two problems --
    valid sudoku and sudoku solver. If you are using the algorithm of sudoku solver to solve valid sudoku, you may output false with this test case, as there is no sudoku solution under this situation, but for valid sudoku the answer must be true.


  • 0
    D

    Okay, got it.

    Thanks for your explanation.


  • 0
    M

    I think Decheng is right. A valid sudoku means a valid sudoku puzzle which is solvable.
    So, We just not only have to check those trivial 3 conditions but also have to check whether this sudoku is solvable or not?


  • 0
    M

    I believe that Shangrila's answer says that a "valid" puzzle simply follows those three rules. It does not need to be solvable. If it had to be solvable as well, there would be no difference in the algorithms between this and Sudoku Solver. Having this just follow the three rules makes sense as a "part 1" for the set, similarly to several other sets on this site.


  • 0
    C

    Agreed to Shangrila. The statement of this problem also says that a valid sudoku is not necessarily to be solvable.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.