Why my test cases arent passing pls help
consider all these answers
if(a[n-1]>0)
{
i=0;
}
if a[n-1] is less than zero, then i is set to zero.
it will run in an infinite loop.
Correct Approach :
first case can be calculated by Kadane.
for second ques, if you multiply the array by -1 and then do kadane it will give min subarray.
as there can be three cases:
- using kadane
2.max prefix+ max suffix; - total-min subarray
Cant understand i have implemented the same algorithm you showed here why arent my test cases passing?
My same code in leetcode is passing all the test cases
If it is passing all test case in leetcode, then don’t worry, you code is correct. I think just some internal test case error. You can mark this as resolved now and i will inform the team about this.
