mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-12-19 02:07:27 +08:00
Fix ruff
This commit is contained in:
@@ -31,8 +31,7 @@ def binomial_coefficient(n: int, k: int) -> int:
|
||||
"""
|
||||
result = 1 # To kept the Calculated Value
|
||||
# Since C(n, k) = C(n, n-k)
|
||||
if k > (n - k):
|
||||
k = n - k
|
||||
k = min(k, n - k)
|
||||
# Calculate C(n,k)
|
||||
for i in range(k):
|
||||
result *= n - i
|
||||
|
||||
Reference in New Issue
Block a user