In this post, I want to share two tutorials for learning to implement a Sudoku Solver in Python. One is from Geeks for Geeks http://www.geeksforgeeks.org/backtracking-set-7-suduku/ I like the code base and especially the 3 x 3 box logic. But I think it could have been improved implementing a Sudoku solver class. The variables can be made more readable and self.grid, self.loc can be instance variables, then it's easier to pass them into the methods find_empty_loc(), used_in_row() etc. It was hard for me to understand the video tutorial of Geeks for Geeks because the audio quality is quite jarring. Quinston's video explanation is more elegant, but the code is less readable, especially the 3 x 3 grid logic. If you find better solutions please let me know. Here's my implementation of this Sudoku Solver in Python loosely based on Geeks for Geeks with more pythonic variable names and method names. https://github.com/theoptips/technical_interview/blob/master/sudoku_geek.py
Your byte size news and commentary from Silicon Valley the land of startup vanities, coding, learn-to-code and unicorn billionaire stories.
Ad
Subscribe to:
Post Comments (Atom)
Error Message Hardhat debugging error unsupported engine hardhat, current node v18
Error message npm WARN EBADENGINE Unsupported engine { package: 'hardhat@2.9.3', required: { node: '^12.0.0 || 14.0.0 || 16.0.0...

-
This review is updated continuously throughout the program. Yay I just joined the Udacity Nanodegree for Digital Marketing! I am such an Uda...
-
The bogus request from P2PU to hunt for HTML tags in real life has yielded a lot of good thoughts. My first impression was that this is stup...
-
Can hack schools solve Silicon Valley's talent crunch? The truth about coding bootcamps and the students left behind http://t.co/xXNfqN...
No comments:
Post a Comment