SIGN IN SIGN UP
TheAlgorithms / Python UNCLAIMED

All Algorithms implemented in Python

0 0 1 Python

Bug fix combinations (#11158)

* Update all_combinations.py

The original implementation had limitations in handling edge cases and certain input parameters, leading to potential RecursionError.

* Update all_combinations.py

Added checks to handle cases where n or k are negative or where k is greater than n. In such scenarios, the function now returns an empty list, avoiding invalid recursive calls.

* Update error handling

Added checks to handle cases where `n` or `k` are negative or where `k` is greater than `n`. In such scenarios, the function now returns an empty list, avoiding invalid recursive calls.

* Update backtracking/all_combinations.py

* Update all_combinations.py

---------

Co-authored-by: Christian Clauss <[email protected]>
M
moaldeen committed
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
Parent: 4151a13
Committed by GitHub <[email protected]> on 11/25/2023, 1:31:17 PM