Program not getting successfull with all the test case, but working on my pc ccmpiler with n number of different inputs.
Please check and let me know the loop hole.
Program not getting successfull with all the test case
Pls send your code by saving on ide so that I could check it…
Program not getting successfull with all the test case. Python problem
I don’t think there is issue in logic, you have given me c++ code and it is using SLT methods and that doesn’t make a better approach. I have solved the problem entirely using logic and not using a inbuilt functions.
Please check the saved program, link.
Hello Prashant, why are you using temp and what are you trying to doing exactly by writing this much code. I mean you have written too much extra things. Kadane algo is simple. Just maintain the current sum and keep on maximising that and if it becomes negative then make current sum equal to zero. And if all the nos. are neg and in the ques it is mentioned that atleast one no. must be there then take the neg no. whose value is max.
Kadane Algo:
def kadane(l):
curSum = 0
maxSum = 0
for ele in l:
curSum += ele
curSum = max(0,curSum)
maxSum = max(maxSum,curSum)
return maxSum
This is the algo just keep on adding and if it is neg then make it 0 and start again. So in this also check when all the nos. are neg. The above code will give 0 in that case so just take care of that.
I hope it is clear to you. In case there is any doubt pls let me know. I will help you out.
And if it is clear pls mark it as resolve and provide the rating / feedback so that we can improve ourselves.
Thanks 
Happy Coding !!
Thanks chirag ,can you provide me the driver code of program, i want to know who you parsed the numbers and what conditions you checking.
want to know how you parsed the set of numbers and put into a list
l=list(map(int,input().split() ) )
please provide the entire program. thanks.
please refer this ->