(self, task_performed, total)
| 14 | |
| 15 | class AssignmentUsingBitmask: |
| 16 | def __init__(self, task_performed, total): |
| 17 | self.total_tasks = total # total no of tasks (N) |
| 18 | |
| 19 | # DP table will have a dimension of (2^M)*N |
| 20 | # initially all values are set to -1 |
| 21 | self.dp = [ |
| 22 | [-1 for i in range(total + 1)] for j in range(2 ** len(task_performed)) |
| 23 | ] |
| 24 | |
| 25 | self.task = defaultdict(list) # stores the list of persons for each task |
| 26 | |
| 27 | # final_mask is used to check if all persons are included by setting all bits |
| 28 | # to 1 |
| 29 | self.final_mask = (1 << len(task_performed)) - 1 |
| 30 | |
| 31 | def count_ways_until(self, mask, task_no): |
| 32 | # if mask == self.finalmask all persons are distributed tasks, return 1 |
nothing calls this directly
no outgoing calls
no test coverage detected