-
-
Notifications
You must be signed in to change notification settings - Fork 190
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 sum of consecutive numbers in an array #162
Labels
enhancement
New feature or request
hacktoberfest-accepted
Hacktoberfest!
help wanted
Extra attention is needed
question
Further information is requested
Comments
wzhouwzhou
added
help wanted
Extra attention is needed
question
Further information is requested
hacktoberfest-accepted
Hacktoberfest!
labels
Oct 29, 2018
gsafcik
added a commit
to gsafcik/one-line-wonders
that referenced
this issue
Oct 31, 2018
Well, I think I got it for Python. |
wzhouwzhou
added a commit
that referenced
this issue
Oct 31, 2018
…onsecutive-nums Added one-liner for issue #162
Solved this issue in pull request |
yashagarwal1999
added a commit
to yashagarwal1999/one-line-wonders
that referenced
this issue
Oct 22, 2019
Solved this issue in pull request |
kannagikazuko
added a commit
that referenced
this issue
Oct 30, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
New feature or request
hacktoberfest-accepted
Hacktoberfest!
help wanted
Extra attention is needed
question
Further information is requested
You are given an array with n distinct integers. Design an algorithm that returns two integers i and j, where i <= j, for which the sum of the elements at positions i, (i+1), ....(j-1), j is maximum.
eg. [1, 4, -2, 6, -5, 3] would return 0 and 3, for i and j respectively. The largest sum of consecutive numbers we can get from this array is 9, 1 + 4 - 2 + 6 = 9.
I haven't seen any one line wonders of this yet, but it can be done in O(n) time when solved normally.
The text was updated successfully, but these errors were encountered: