Python
Python copied to clipboard
Update segment_tree.py
Describe your change:
What does this PR do?
By using self.N instead of N, we can ensure that each instance of the class has its own N attribute, and we can avoid using a global variable inside the class method.
- [ Y] Fix a bug or typo in an existing algorithm? Yes
Checklist:
- [Y] I have read CONTRIBUTING.md.
- [Y] This pull request is all my own work -- I have not plagiarized.
- [Y] I know that pull requests will not be merged if they fail the automated tests.
- [Y] This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
- [Y ] All new Python files are placed inside an existing directory.
- [ Y] All filenames are in all lowercase characters with no spaces or dashes.
- [ Y] All functions and variable names follow Python naming conventions.
- [ Y] All function parameters and return values are annotated with Python type hints.
- [Y ] All functions have doctests that pass the automated testing.
- [Y ] All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
- [Y ] If this pull request resolves one or more open issues then the description above includes the issue number(s) with a closing keyword: "Fixes #11232".