Kadane's algorithm! grr..