My take on an interviewing favorite.
Verify that a given 9x9 table represented as a string in row major order is a sedoku.
The approach here is:
- define a verifier for a single 9 element vector, based on ensuring that all the possible entries appear.
- traverse the proposed solution three ways, row, column, and block, with each one traversing the 9 rows/columns/blocks 2.1. in each of these traversals create the corrsesponding 9 element vector and verify it using 1. above
The traverser functions are there to define the arithmentic used to pull out the element from the original board representation (a string) corresponding to the major and minor traversal indexes. A major index would be for example a row numbers, and minor one would be the element inside the row.
Also note that this is a verifier, not a solver.