A twist on Kadane's algorithm where you must track both max and min because a negative times a negative becomes positive.
Enable JavaScript for the full StreamPrep guide.