30 int64_t current_max = INT_MIN, current_sum = 0;
31 for (
int i = 0; i < length; i++) {
32 current_sum = current_sum + arr[i];
33 if (current_max < current_sum) {
34 current_max = current_sum;
37 if (current_sum < 0) {
49 std::array<int64_t, 4> arr = {1, 2, 3, 4};
50 std::array<int64_t, 5> arr1 = {-1, -2, -4, -6, 7};
53 std::cout <<
"All test cases have passed!\n";