Question d’entretien chez Amazon

Sliding window like question (Kadane's algorithm)