Skip to content

Commit c2ef1ce

Browse files
authored
Apply suggestion from @cclauss
1 parent c6c4578 commit c2ef1ce

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

maths/derangement.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ def derangement(objects: int) -> int:
2424
raise ValueError("k must be a non-negative integer. Retry")
2525

2626
# Base cases
27-
if objects == 0:
28-
return 0
29-
if objects == 1:
27+
if objects in (0, 1):
3028
return 0
3129

3230
# Initialize the derangement counts

0 commit comments

Comments
 (0)