Python/other
Pronoy Mandal 528b129019
Update maximum_subarray.py (#7757)
* Update maximum_subarray.py

1. Rectify documentation to indicate the correct output: function doesn't return the subarray, but rather returns a sum.
2. Make the function more Pythonic and optimal.
3. Make function annotation generic i.e. can accept any sequence.
4. Raise value error when the input sequence is empty.

* Update maximum_subarray.py

1. Use the conventions as mentioned in pep-0257.
2. Use negative infinity as the initial value for the current maximum and the answer.

* Update maximum_subarray.py

Avoid type conflict by returning the answer cast to an integer.

* Update other/maximum_subarray.py

Co-authored-by: Andrey <Cjkjvfnby@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update maximum_subarray.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update maximum_subarray.py

Remove typecast to int for the final answer

Co-authored-by: Andrey <Cjkjvfnby@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-28 21:08:41 +02:00
..
__init__.py Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00
activity_selection.py [mypy] Adds type annotations in other/activity_selection #4052 (#5590) 2021-10-26 12:10:37 +02:00
alternative_list_arrange.py Added alternative_list_arrange method (#4631) 2021-10-31 11:40:32 +01:00
check_strong_password.py Added check_strong_password.py (#4950) 2021-10-20 07:35:41 +02:00
davisb_putnamb_logemannb_loveland.py Add Flake8 comprehensions to pre-commit (#7235) 2022-10-15 19:29:42 +02:00
dijkstra_bankers_algorithm.py from __future__ import annotations (#2464) 2020-09-23 13:30:13 +02:00
doomsday.py Add doomsday algorithm (#2903) 2020-10-07 20:22:56 +08:00
fischer_yates_shuffle.py [mypy] Fix other/fischer_yates_shuffle.py (#5789) 2021-11-07 11:14:42 +01:00
gauss_easter.py Easter date gauss algorithm (#2010) 2020-05-19 13:44:45 +02:00
graham_scan.py [mypy-fix] Type fixes for graham_scan (#5589) 2021-10-26 11:50:36 +02:00
greedy.py Add pep8-naming to pre-commit hooks and fixes incorrect naming conventions (#7062) 2022-10-13 00:54:20 +02:00
least_recently_used.py [Mypy] fix other/least_recently_used (#5814) 2021-11-16 15:01:17 +01:00
lfu_cache.py Add flake8 pluin flake8 bugbear to pre-commit (#7132) 2022-10-13 18:03:06 +02:00
linear_congruential_generator.py Approve functions used as default arguments (#4699) 2021-08-31 07:56:19 +02:00
lru_cache.py Add flake8 pluin flake8 bugbear to pre-commit (#7132) 2022-10-13 18:03:06 +02:00
magicdiamondpattern.py Add flake8 pluin flake8 bugbear to pre-commit (#7132) 2022-10-13 18:03:06 +02:00
maximum_subarray.py Update maximum_subarray.py (#7757) 2022-10-28 21:08:41 +02:00
nested_brackets.py Add pep8-naming to pre-commit hooks and fixes incorrect naming conventions (#7062) 2022-10-13 00:54:20 +02:00
password_generator.py Lowercase g --> Capital G (#5845) 2021-11-24 15:23:44 +01:00
scoring_algorithm.py Add flake8 pluin flake8 bugbear to pre-commit (#7132) 2022-10-13 18:03:06 +02:00
sdes.py Add pep8-naming to pre-commit hooks and fixes incorrect naming conventions (#7062) 2022-10-13 00:54:20 +02:00
tower_of_hanoi.py Add pep8-naming to pre-commit hooks and fixes incorrect naming conventions (#7062) 2022-10-13 00:54:20 +02:00