摘要:
输入一个整形数组,数组里有正数也有负数。数组中连续的一个或多个整数组成一个子数组,每个子数组都有一个和。求所有子数组的和的最大值。要求时间复杂度为O(n)。 1 #include <iostream> 2 #include <ctime> 3 #include <random> 4 5 using namespace std; 6 7 /************************************************* 8 Function: // maxSubArray 9 Description: // 求整数数组中子数组的最大和。这个1 阅读全文