Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dynamic_programming/bitmask.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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]:
Expand Down