A cool algorithm to check a Sudoku field?

前端 未结 25 795
清酒与你
清酒与你 2021-01-30 09:19

Does anyone know a simple algorithm to check if a Sudoku-Configuration is valid? The simplest algorithm I came up with is (for a board of size n) in Pseudocode

f         


        
25条回答
  •  无人共我
    2021-01-30 09:53

    Create cell sets, where each set contains 9 cells, and create sets for vertical columns, horizontal rows, and 3x3 squares.

    Then for each cell, simply identify the sets it's part of and analyze those.

提交回复
热议问题