Merge pull request #557 from dagolinuxoid/patch-2

a tiny correction
This commit is contained in:
Ilya Kantor 2018-10-20 23:21:52 +03:00 committed by GitHub
commit f07ca04334
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,7 +8,7 @@ The input is an array of numbers, e.g. `arr = [1, -2, 3, 4, -9, 6]`.
The task is: find the contiguous subarray of `arr` with the maximal sum of items. The task is: find the contiguous subarray of `arr` with the maximal sum of items.
Write the function `getMaxSubSum(arr)` that will find return that sum. Write the function `getMaxSubSum(arr)` that will return that sum.
For instance: For instance:
@ -27,4 +27,4 @@ If all items are negative, it means that we take none (the subarray is empty), s
getMaxSubSum([-1, -2, -3]) = 0 getMaxSubSum([-1, -2, -3]) = 0
``` ```
Please try to think of a fast solution: [O(n<sup>2</sup>)](https://en.wikipedia.org/wiki/Big_O_notation) or even O(n) if you can. Please try to think of a fast solution: [O(n<sup>2</sup>)](https://en.wikipedia.org/wiki/Big_O_notation) or even O(n) if you can.