We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Project Euler #96: Su Doku
Project Euler #96: Su Doku
Sort by
recency
|
35 Discussions
|
Please Login in order to post a comment
C++
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