implement maximum contiguous sub array