mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
Add static typing to backtracking algorithms (#2684)
* Added static typing to backtracking algorithms
* Ran psf/black to fix some minor issues.
* updating DIRECTORY.md
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
This commit is contained in:
@@ -16,7 +16,13 @@ def generate_all_combinations(n: int, k: int) -> [[int]]:
|
||||
return result
|
||||
|
||||
|
||||
def create_all_state(increment, total_number, level, current_list, total_list):
|
||||
def create_all_state(
|
||||
increment: int,
|
||||
total_number: int,
|
||||
level: int,
|
||||
current_list: [int],
|
||||
total_list: [int],
|
||||
) -> None:
|
||||
if level == 0:
|
||||
total_list.append(current_list[:])
|
||||
return
|
||||
@@ -27,7 +33,7 @@ def create_all_state(increment, total_number, level, current_list, total_list):
|
||||
current_list.pop()
|
||||
|
||||
|
||||
def print_all_state(total_list):
|
||||
def print_all_state(total_list: [int]) -> None:
|
||||
for i in total_list:
|
||||
print(*i)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user