-
-
Notifications
You must be signed in to change notification settings - Fork 46.8k
Largest subarray sum #1404
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
Largest subarray sum #1404
Conversation
Travis CI tests are failing. See CONTRIBUTING.md for details. This repo no longer supports legacy Python. https://travis-ci.com/TheAlgorithms/Python/builds/132670589#L352 |
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.
print()
|
This is what a Pythonic function name, type hints, a doctest, and a default argument would look like. def max_sub_array_sum(a: list, size: int = 0):
"""
>>> max_sub_array_sum([-13, -3, -25, -20, -3, -16, -23, -12, -5, -22, -15, -4, -7])
-3
"""
size = size or len(a) |
It is working on my system but the travis CI test failed |
On your system, what happens when you type:
|
Doctests are just docstrings until you run The problem that Travis is complaining about is that the doctest is using a Pythonic function name but the code is using a JavaScript-style function name. |
@@ -1,5 +1,5 @@ | |||
from sys import maxsize | |||
def maxSubArraySum(a: list, size: int = 0): | |||
def max_Sub_Array_Sum(a: list, size: int = 0): | |||
""" | |||
>>> max_sub_array_sum([-13, -3, -25, -20, -3, -16, -23, -12, -5, -22, -15, -4, -7]) |
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.
Let’s be Pythonic and use max_sub_array_sum
everywhere.
* Insertion_sort * largest subarray sum * updated print command * removed extraspaces * removed sys.maxint * added explaination * Updated function style * Update largest_subarray_sum.py * Update i_sort.py * Delete bogo_bogo_sort.py
It contains the code of how to find the largest subarray sum in Python.