Skip to content
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

Bnb tries fixed for examples #69

Merged
merged 2 commits into from
Oct 23, 2024
Merged

Conversation

NeoZ666
Copy link
Contributor

@NeoZ666 NeoZ666 commented Oct 22, 2024

No description provided.

@NeoZ666 NeoZ666 mentioned this pull request Oct 22, 2024
Copy link
Collaborator

@delcin-raj delcin-raj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The decrement should happen after checking if bnb_tries is non zero

Copy link
Collaborator

@delcin-raj delcin-raj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every bnb recursive invocation is referring the global bnb_tries variable (global for the recursive function calls).

So it is enough to check at the beginning and decrement at the beginning, because the successive recursive calls will terminate if the tries ever became zero.

We also should not decrement when it goes to zero, that's why we check for zero before decrementing.

@delcin-raj delcin-raj merged commit e7409cb into Bitshala-Incubator:main Oct 23, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants