Sort 34 Discussions, By:
Please Login in order to post a comment
A great exercise since it's so open-ended as to how you really want to solve it. Excellent practice for OOP, since constructing helper functions and ultimately classes will make it all a lot easier than manipulating strings directly.
Overall, thought it was going to be harder: I pre-emptively built out an "update" loop in my class that I thought I was going to have to flesh out with various sudoku strategies, with recursive backtracking always running after other optimizations. But my first attempt culling candidates by obvious singles was enough to optimize it to pass; I didn't need to employ "hidden" singles or any other higher-level Sudoku strategies. If I wanted to race against others, maybe!
Can we improve time limit ?
For project Sudoku?
My code is optimizable by changing depth of search 3 to 4 and by changing how many sudoku depth we search in each guess
I optimized my code, it runs at least 14-17 / 20 BUT and times out the rest
No wrong answer
Some times my code times out in test1, 19, sometimes it times out in test3, 4
I would say my code is running 100%, but timing is not letting that.
A fun exerise! Helps me understand DFS a bit better now. The key to performance is to always find the position which has the least number of candidates.
Each position has nine (1-9) candidates at first. Use the row, col and block information then the candidates can be reduced.
you can find my java solution here
Hello, I have tried to make code without backtracking/recursivity, I can solve all except case 6, do you know what case is this? I wanted to debug to see what is happening...
My code is a bit complex, but is not, just look ate function "Solve(int[,] array)" and from there navigate to the strategies to solve sudoku: