From edf86617bef3fedaba2d0934d71482635975cdb6 Mon Sep 17 00:00:00 2001 From: Saksham Chawla <51916697+saksham-chawla@users.noreply.github.com> Date: Mon, 2 Oct 2023 19:28:06 +0530 Subject: [PATCH] Add typing to bitmask.py --- dynamic_programming/bitmask.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dynamic_programming/bitmask.py b/dynamic_programming/bitmask.py index 56bb8e96ba02..c92d718858bd 100644 --- a/dynamic_programming/bitmask.py +++ b/dynamic_programming/bitmask.py @@ -12,7 +12,7 @@ class AssignmentUsingBitmask: - def __init__(self, task_performed, total): + def __init__(self, task_performed: int, total: int): self.total_tasks = total # total no of tasks (N) # DP table will have a dimension of (2^M)*N @@ -27,7 +27,7 @@ def __init__(self, task_performed, total): # to 1 self.final_mask = (1 << len(task_performed)) - 1 - def count_ways_until(self, mask, task_no): + def count_ways_until(self, mask: int, task_no: int) -> int: # if mask == self.finalmask all persons are distributed tasks, return 1 if mask == self.final_mask: return 1 @@ -60,7 +60,7 @@ def count_ways_until(self, mask, task_no): return self.dp[mask][task_no] - def count_no_of_ways(self, task_performed): + def count_no_of_ways(self, task_performed: int) -> int: # Store the list of persons for each task for i in range(len(task_performed)): for j in task_performed[i]: