-
Notifications
You must be signed in to change notification settings - Fork 180
Arrays #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Arrays #115
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
234e6ba
js.uk: 4 arrays
1364709
fix errors
ccf80a6
fix
0f5a847
Address some possible issues in translation of 1.2.9
vsemozhetbyt 39fd695
Address some possible issues in 1.2.11
vsemozhetbyt 4d0ed20
Address review suggestions
vsemozhetbyt f3d5f49
Merge pull request #118 from vsemozhetbyt/1.2.10
tarasyyyk e63ed1c
Update 1-js/02-first-steps/09-comparison/article.md
tarasyyyk c4c0d10
Merge pull request #117 from vsemozhetbyt/1.2.9
tarasyyyk 0ec4f1a
Merge pull request #119 from vsemozhetbyt/1.2.11
tarasyyyk 469f8b7
Merge branch 'master' into master
ArtemZununov 0c13849
Update 1-js/05-data-types/04-array/1-item-value/solution.md
ArtemZununov e144e4c
Update 1-js/05-data-types/04-array/1-item-value/task.md
ArtemZununov f625bfd
Update 1-js/05-data-types/04-array/10-maximal-subarray/solution.md
ArtemZununov b292336
Update 1-js/05-data-types/04-array/10-maximal-subarray/solution.md
ArtemZununov 18aa57d
Update 1-js/05-data-types/04-array/10-maximal-subarray/solution.md
ArtemZununov 346df19
Update 1-js/05-data-types/04-array/article.md
ArtemZununov 553d1bf
Update 1-js/05-data-types/04-array/article.md
ArtemZununov 5c53bb0
Update 1-js/05-data-types/04-array/10-maximal-subarray/task.md
ArtemZununov 3428177
Update 1-js/05-data-types/04-array/10-maximal-subarray/task.md
ArtemZununov 0a33c74
Update 1-js/05-data-types/04-array/2-create-array/task.md
ArtemZununov 9dda948
Update 1-js/05-data-types/04-array/10-maximal-subarray/task.md
ArtemZununov 2959f84
Update 1-js/05-data-types/04-array/5-array-input-sum/solution.md
ArtemZununov f4a3cad
Update 1-js/05-data-types/04-array/3-call-array-this/solution.md
ArtemZununov 3f3fd8d
Update 1-js/05-data-types/04-array/3-call-array-this/solution.md
ArtemZununov fbad78f
Update 1-js/05-data-types/04-array/article.md
ArtemZununov e3b6dc3
Update 1-js/05-data-types/04-array/3-call-array-this/task.md
ArtemZununov 37e4fec
Update 1-js/05-data-types/04-array/3-call-array-this/task.md
ArtemZununov c934ebf
Update 1-js/05-data-types/04-array/5-array-input-sum/solution.md
ArtemZununov eab4e7e
Update 1-js/05-data-types/04-array/5-array-input-sum/task.md
ArtemZununov 3daeba3
Update 1-js/05-data-types/04-array/article.md
ArtemZununov 6695273
Update 1-js/05-data-types/04-array/article.md
ArtemZununov 9155264
Update 1-js/05-data-types/04-array/article.md
ArtemZununov 6b611f0
Update 1-js/05-data-types/04-array/article.md
ArtemZununov 6946dc3
Merge branch 'master' into master
tarasyyyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,15 @@ importance: 2 | |
|
||
--- | ||
|
||
# A maximal subarray | ||
# Максимальний підмасив | ||
|
||
The input is an array of numbers, e.g. `arr = [1, -2, 3, 4, -9, 6]`. | ||
На вході масив чисел, наприклад `arr = [1, -2, 3, 4, -9, 6]`. | ||
|
||
The task is: find the contiguous subarray of `arr` with the maximal sum of items. | ||
Завдання: знайти неперервний підмасив `arr` з максимальною сумою елементів. | ||
|
||
Write the function `getMaxSubSum(arr)` that will return that sum. | ||
Написати функцію `getMaxSubSum(arr)` яка повертає таку суму. | ||
|
||
For instance: | ||
Наприклад: | ||
|
||
```js | ||
getMaxSubSum([-1, *!*2, 3*/!*, -9]) == 5 (the sum of highlighted items) | ||
|
@@ -21,10 +21,10 @@ getMaxSubSum([*!*100*/!*, -9, 2, -3, 5]) == 100 | |
getMaxSubSum([*!*1, 2, 3*/!*]) == 6 (take all) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Будь ласка, перекладіть коментарі в коді вище. |
||
``` | ||
|
||
If all items are negative, it means that we take none (the subarray is empty), so the sum is zero: | ||
Якщо всі елементи менші нуля, нічого не беремо, це означає, що підмасив пустий, а сума рівна нулю: | ||
|
||
```js | ||
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. | ||
Будь ласка, подумайте над швидким рішенням: [O(n<sup>2</sup>)](https://uk.wikipedia.org/wiki/Нотація_Ландау) або навіть над рішенням O(n), якщо зможете. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Будь ласка, перекладіть також коментарі в коді вище.