Pregunta de entrevista de Amazon

Sliding window like question (Kadane's algorithm)