How will the Kadane’s algorithm work if the array is filled only with negative numbers? It will give the answer as 0, which is wrong. This case has not been taken into consideration.
Kadane's algorithm with all negative numbers
@Akhil-AT-2475458612516361 hey akhil you’re right bhaiya try to teach the intitution of kadane algo
for negative no you should this implementation code.
the condition of kadane algo is that atleast one number should be +ve ,if all the number will the -ve then the answer will be simply the least -ve number,that we can easily find.
1 Like