What is the space complexity of Kadane's algorithm?
O(1)
O(n)
O(n^{2})
None of the mentioned
Correct Answer: A — O(1)
Explanation:
Kadane's algorithm uses a constant space. So, the space complexity is O(1).