MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / time_solve

Function time_solve

data_structures/arrays/sudoku_solver.py:176–186  ·  view source on GitHub ↗
(grid)

Source from the content-addressed store, hash-verified

174 """
175
176 def time_solve(grid):
177 start = time.monotonic()
178 values = solve(grid)
179 t = time.monotonic() - start
180 ## Display puzzles that take long enough
181 if showif is not None and t > showif:
182 display(grid_values(grid))
183 if values:
184 display(values)
185 print(f"({t:.5f} seconds)\n")
186 return (t, solved(values))
187
188 times, results = zip(*[time_solve(grid) for grid in grids])
189 if (n := len(grids)) > 1:

Callers 1

solve_allFunction · 0.85

Calls 4

displayFunction · 0.85
grid_valuesFunction · 0.85
solvedFunction · 0.85
solveFunction · 0.70

Tested by

no test coverage detected