A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://TheAlgorithms.github.io/C-Plus-Plus/de/dcd/kadanes3_8cpp_source.html below:

TheAlgorithms/C++: others/kadanes3.cpp Source File

Go to the documentation of this file. 28template

<std::

size_t

SIZE>

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"

;

int max_subarray_sum(std::array< int64_t, SIZE > arr, uint64_t length)

for IO operations

static void test()

Self-test implementations.

int main()

Main function.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4