Saturday, December 9, 2017

Sudoku Solver using Python Technical Interview Question

In this post, I want to share two tutorials for learning to implement a Sudoku Solver in Python. One is from Geeks for Geeks 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.

No comments:

Post a Comment

Getting Started Coding Amazon Alexa Skills for Developers

Getting Started First read our blog post on how to get started with Alexa Skill building or watch our youtube video on the topic Blog...