added implementation of Kadane's algorithm