MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / find_empty_location

Function find_empty_location

backtracking/sudoku.py:63–72  ·  view source on GitHub ↗

This function finds an empty location so that we can assign a number for that particular row and column.

(grid: Matrix)

Source from the content-addressed store, hash-verified

61
62
63def find_empty_location(grid: Matrix) -> tuple[int, int] | None:
64 """
65 This function finds an empty location so that we can assign a number
66 for that particular row and column.
67 """
68 for i in range(9):
69 for j in range(9):
70 if grid[i][j] == 0:
71 return i, j
72 return None
73
74
75def sudoku(grid: Matrix) -> Matrix | None:

Callers 1

sudokuFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected