-
-
Notifications
You must be signed in to change notification settings - Fork 46.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update permutations.py #8102
Update permutations.py #8102
Conversation
Earlier in the permutation function it is creating an infinite recursion which is causing an error instead of that I used backtracking to get the output
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of deleting the old code, perhaps create an alternate function using the backtracking method, while keeping the original function.
modified permute function which is using recursive methode to permute2 function which is using backtracking to find the output
for more information, see https://pre-commit.ci
I have created a new function named as permute2 with the backtracking method |
for more information, see https://pre-commit.ci
@@ -1,7 +1,9 @@ | |||
from typing import List | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove from typing import List
as it is unused , creating pre-commit error.
for more information, see https://pre-commit.ci
added test case in permute2 fuction
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the tests need to inline, otherwise they fail.
Earlier in the permutation function it is creating an infinite recursion which is causing an error
instead of that I used backtracking to get the output
*[x] Fixed a bug or typo in an existing algorithm in permutations.py?