Sudoku-solver test failing, but how to fix the code?

Tell us what’s happening:
Describe your issue in detail here.

The following test is failing. My code fails the entry even if on same spot in puzzle. But I can’t think what is wrong in the code.

If value submitted to /api/check is already placed in puzzle on that coordinate, the returned value will be an object containing a valid property with true if value is not conflicting.

Your project link(s)

solution: https://replit.com/@dmikes/sudoku

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.115 Safari/537.36

Challenge: Sudoku Solver

Link to the challenge:

I found it!

in the checks for valid entries I had:

    if (grid[row - 1][col - 1] == 0) return false;

and I changed it to:

    if (grid[row - 1][col - 1] == value) return true;
2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.