mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 17:34:49 +08:00
pre-commit: Upgrade psf/black for stable style 2023 (#8110)
* pre-commit: Upgrade psf/black for stable style 2023 Updating https://github.com/psf/black ... updating 22.12.0 -> 23.1.0 for their `2023 stable style`. * https://github.com/psf/black/blob/main/CHANGES.md#2310 > This is the first [psf/black] release of 2023, and following our stability policy, it comes with a number of improvements to our stable style… Also, add https://github.com/tox-dev/pyproject-fmt and https://github.com/abravalheri/validate-pyproject to pre-commit. I only modified `.pre-commit-config.yaml` and all other files were modified by pre-commit.ci and psf/black. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -13,7 +13,6 @@ from collections import defaultdict
|
||||
|
||||
class AssignmentUsingBitmask:
|
||||
def __init__(self, task_performed, total):
|
||||
|
||||
self.total_tasks = total # total no of tasks (N)
|
||||
|
||||
# DP table will have a dimension of (2^M)*N
|
||||
@ -29,7 +28,6 @@ class AssignmentUsingBitmask:
|
||||
self.final_mask = (1 << len(task_performed)) - 1
|
||||
|
||||
def count_ways_until(self, mask, task_no):
|
||||
|
||||
# if mask == self.finalmask all persons are distributed tasks, return 1
|
||||
if mask == self.final_mask:
|
||||
return 1
|
||||
@ -49,7 +47,6 @@ class AssignmentUsingBitmask:
|
||||
# assign for the remaining tasks.
|
||||
if task_no in self.task:
|
||||
for p in self.task[task_no]:
|
||||
|
||||
# if p is already given a task
|
||||
if mask & (1 << p):
|
||||
continue
|
||||
@ -64,7 +61,6 @@ class AssignmentUsingBitmask:
|
||||
return self.dp[mask][task_no]
|
||||
|
||||
def count_no_of_ways(self, task_performed):
|
||||
|
||||
# Store the list of persons for each task
|
||||
for i in range(len(task_performed)):
|
||||
for j in task_performed[i]:
|
||||
@ -75,7 +71,6 @@ class AssignmentUsingBitmask:
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
total_tasks = 5 # total no of tasks (the value of N)
|
||||
|
||||
# the list of tasks that can be done by M persons.
|
||||
|
@ -9,7 +9,6 @@ from __future__ import annotations
|
||||
|
||||
|
||||
def list_of_submasks(mask: int) -> list[int]:
|
||||
|
||||
"""
|
||||
Args:
|
||||
mask : number which shows mask ( always integer > 0, zero does not have any
|
||||
|
Reference in New Issue
Block a user