-
-
Notifications
You must be signed in to change notification settings - Fork 46.5k
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
Created max_sum_sliding_window in Python/other #3065
Conversation
@dhruvmanila @shellhub, Please review it. |
I might be wrong but it seems that this is an incorrect algorithm. As far as I understand you are finding the maximum value from the sum of k consecutive integers in a list of integers which means: >>> arr = [1, 4, 2, 10, 2, 13, 1, 0, 2]
>>> k = 4
>>> max_sum(arr, k) # This should give me 27
16 Your algorithm provides 16 as the answer but the answer clearly is 27. Your algorithm is just giving the sum of the last k integers. If so, please test your algorithm thoroughly before submitting. Use black box and white box testing, random tests and especially test the edge cases. |
There was a bug in the program. I corrected it and added more tests. Now the algorithm works just the way it should. |
Also, can you take a look at #3094 ? |
* Add files via upload * Update max_sum_sliding_window.py * Update max_sum_sliding_window.py * Update max_sum_sliding_window.py * Added more tests * Update max_sum_sliding_window.py * Update max_sum_sliding_window.py
* Add files via upload * Update max_sum_sliding_window.py * Update max_sum_sliding_window.py * Update max_sum_sliding_window.py * Added more tests * Update max_sum_sliding_window.py * Update max_sum_sliding_window.py
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}
.