Incorrect solution provided

In Maximum Subarray Sum 3 video,
If we gave [-1,-2] as input to the solution provided in Maximum Subarray Sum 3 video, it’s printing 0 as answer, however the answer should be -1.
That means the soution provided in video is incorrect?

No the solution assumes that all elements are greater than equal to 0.
In such a case you are supposed to traverse the array and find out the max element .
If (max element <= 0) print the max Element as the answer.
else run the algorithm as described in the video

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.