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:
Jenia Dysin
2020-11-29 18:19:50 +02:00
committed by GitHub
parent 5de90aafc7
commit e07766230d
6 changed files with 34 additions and 16 deletions

View File

@@ -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)