Two Sigma interview question

Max consecutive sum algorithm