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

Function is_complete

backtracking/knight_tour.py:35–46  ·  view source on GitHub ↗

Check if the board (matrix) has been completely filled with non-zero values. >>> is_complete([[1]]) True >>> is_complete([[1, 2], [3, 0]]) False

(board: list[list[int]])

Source from the content-addressed store, hash-verified

33
34
35def is_complete(board: list[list[int]]) -> bool:
36 """
37 Check if the board (matrix) has been completely filled with non-zero values.
38
39 >>> is_complete([[1]])
40 True
41
42 >>> is_complete([[1, 2], [3, 0]])
43 False
44 """
45
46 return not any(elem == 0 for row in board for elem in row)
47
48
49def open_knight_tour_helper(

Callers 1

open_knight_tour_helperFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected