Closed sagar-monga closed 3 years ago
Shall I raise a new pr for the same?
@sagar-monga, This is PR only. You asked for assigning the question, then it was assigned to you, then you have solved it, then you created a PR. All steps done.
What I have requested is that in logical parts of the code just add the comments and I will take it for successful merging
Actually, my fork is corrupted so I need to take a new fork. I will close this PR and raise a new one with the required changes. Thankyou.
Issue Id you have worked upon -
245
Briefly explain your program logic -
I have used Kadane's Algorithm to solve the problem. We keep track of the largest subsequence till the current element and if upon adding the current element, we find that the sum exceeds the maximum sum, we add the current element to the longest subsequence. Otherwise, drop the previous sum, and replace it with the current element instead.
Screenshots(Attach 2 screenshots of your own input and output) -
Input
Output
Checklist:
Eg - If your code follow the below guidelines. Kindly change [] to [x]
All the conditions should be fulfilled for considering your code for merging -
[x] I have mentioned the question as comment in my solution file.
[x] My code follows the guidelines of this project.
[x] I have performed a self-review of my own code.
[x] I have commented my code.
[x] My code gives the correct output.
[x] I confirm that I have not copied the code from anywhere. In case its found that I have copied even after successful merge then I can be banned from the repository and hacktoberfest.
[x] I affirm that I strictly follow contributing guidelines and code of conduct.