Commit Graph

2 Commits

Author SHA1 Message Date
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
Jay Gala
072312bd0a
Added code for Maximum Subarray Sum (#6536)
* Added maximum subarray sum #6519

* fixes: #6519 function names changed as per naming conventions
2022-10-02 16:49:49 +02:00