Sudoku solver - Failed at one test only

Tell us what’s happening:
I passed all tests except the one below.

You can POST /api/solve with form data containing puzzle which will be a string containing a combination of numbers (1-9) and periods . to represent empty spaces. The returned object will contain a solution property with the solved puzzle.

I tried to log puzzleString when FCC runed their test. I saw 4 puzzleString.

  • One is a valid string and I saw my API returned a solution.
  • 2 are invalid puzzleString which contains invalid characters and invalid length.
  • The last one is the puzzle that cannot be solved.

I think there might be errors somewhere in my solver method.

Your project link(s)

Solution: https://boilerplate-project-sudoku-solver.japananh.repl.co
Replit: https://repl.it/@japananh/boilerplate-project-sudoku-solver

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36.

Challenge: Sudoku Solver

Link to the challenge:

1 Like

I found a bug in my solve method that returns incorrect results. I changed the logic of it then all tests passed.