Imperative Programming HT23, Maximum segment sum