Amazon interview question

Maximal Subarray(It is a standard question)