# Leetcode: Valid sudoku

Given a Sudoku field as a two-dimension list, determine if the field is valid. A valid field only has the number 1-9 once in each sub-field, each row, and each column. The field is not completely filled and we don’t need to check for a valid solution. The solution for this task is written in the conditions for a valid Sudoku field. We create a `set` for each row, each column, and each sub-field. If a number is duplicated in any of those, the field is not valid. If we don’t find any violation until the end, the field is valid. The remaining problem is to filter out the empty fields (`.`) and to find the correct sub-field. For the second part, we can leverage Pythons full integer division and determine the field as follows: `field = 3 * (row // 3) + (column // 3)`. This yields numbers from `[0-8]`. This solution is faster than 96% of the submitted solutions at leetcode. It does use `O(3*n)` memory in the worst case, as every element needs to be stored in each set.