Loading practice questions
For which of the following inputs would Kadane's algorithm produce the INCORRECT output?
Correct Answer: D — {-4,-3,-2,-1}
Explanation:
Kadane's algorithm works if the input array contains at least one non-negative element. Every element in the array {-4,-3,-2,-1} is negative. Hence Kadane's algorithm won't work.