There was an error while loading. Please reload this page.
1 parent c6c4578 commit c2ef1ceCopy full SHA for c2ef1ce
1 file changed
maths/derangement.py
@@ -24,9 +24,7 @@ def derangement(objects: int) -> int:
24
raise ValueError("k must be a non-negative integer. Retry")
25
26
# Base cases
27
- if objects == 0:
28
- return 0
29
- if objects == 1:
+ if objects in (0, 1):
30
return 0
31
32
# Initialize the derangement counts
0 commit comments