Repository navigation
Arrays #479
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
Open
diogoosz
wants to merge
1
commit into
javascript-tutorial:master
Choose a base branch
from
diogoosz:translate-arrays
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Arrays #479
Changes from all commits
Commits
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
18 changes: 9 additions & 9 deletions
18
1-js/05-data-types/04-array/10-maximal-subarray/_js.view/test.js
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 |
|---|---|---|
| @@ -1,37 +1,37 @@ | ||
| describe("getMaxSubSum", function() { | ||
| it("maximal subsum of [1, 2, 3] equals 6", function() { | ||
| it("subsoma máxima de [1, 2, 3] é igual a 6", function() { | ||
| assert.equal(getMaxSubSum([1, 2, 3]), 6); | ||
| }); | ||
|
|
||
| it("maximal subsum of [-1, 2, 3, -9] equals 5", function() { | ||
| it("subsoma máxima de [-1, 2, 3, -9] é igual a 5", function() { | ||
| assert.equal(getMaxSubSum([-1, 2, 3, -9]), 5); | ||
| }); | ||
|
|
||
| it("maximal subsum of [-1, 2, 3, -9, 11] equals 11", function() { | ||
| it("subsoma máxima de [-1, 2, 3, -9, 11] é igual a 11", function() { | ||
| assert.equal(getMaxSubSum([-1, 2, 3, -9, 11]), 11); | ||
| }); | ||
|
|
||
| it("maximal subsum of [-2, -1, 1, 2] equals 3", function() { | ||
| it("subsoma máxima de [-2, -1, 1, 2] é igual a 3", function() { | ||
| assert.equal(getMaxSubSum([-2, -1, 1, 2]), 3); | ||
| }); | ||
|
|
||
| it("maximal subsum of [100, -9, 2, -3, 5] equals 100", function() { | ||
| it("subsoma máxima de [100, -9, 2, -3, 5] é igual a 100", function() { | ||
| assert.equal(getMaxSubSum([100, -9, 2, -3, 5]), 100); | ||
| }); | ||
|
|
||
| it("maximal subsum of [] equals 0", function() { | ||
| it("subsoma máxima de [] é igual a 0", function() { | ||
| assert.equal(getMaxSubSum([]), 0); | ||
| }); | ||
|
|
||
| it("maximal subsum of [-1] equals 0", function() { | ||
| it("subsoma máxima de [-1] é igual a 0", function() { | ||
| assert.equal(getMaxSubSum([-1]), 0); | ||
| }); | ||
|
|
||
| it("maximal subsum of [-1, -2] equals 0", function() { | ||
| it("subsoma máxima de [-1, -2] é igual a 0", function() { | ||
| assert.equal(getMaxSubSum([-1, -2]), 0); | ||
| }); | ||
|
|
||
| it("maximal subsum of [2, -8, 5, -1, 2, -3, 2] equals 6", function() { | ||
| it("subsoma máxima de [2, -8, 5, -1, 2, -3, 2] é igual a 6", function() { | ||
| assert.equal(getMaxSubSum([2, -8, 5, -1, 2, -3, 2]), 6); | ||
| }); | ||
| }); |
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
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 | ||||
|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||
| Please note the subtle, but important detail of the solution. We don't convert `value` to number instantly after `prompt`, because after `value = +value` we would not be able to tell an empty string (stop sign) from the zero (valid number). We do it later instead. | ||||||
| Observe o detalhe sutil, mas importante, da solução. Não convertemos `value` para número logo depois do `prompt`, porque depois de `value = +value` não conseguiríamos mais distinguir uma string vazia (sinal de parada) do zero (número válido). Fazemos isso mais tarde, em vez disso. | ||||||
|
Contributor
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. Redundância: "mais tarde, em vez disso".
Suggested change
|
||||||
|
|
||||||
|
|
||||||
| ```js run demo | ||||||
|
|
@@ -8,9 +8,9 @@ function sumInput() { | |||||
|
|
||||||
| while (true) { | ||||||
|
|
||||||
| let value = prompt("A number please?", 0); | ||||||
| let value = prompt("Um número, por favor?", 0); | ||||||
|
|
||||||
| // should we cancel? | ||||||
| // devemos cancelar? | ||||||
| if (value === "" || value === null || !isFinite(value)) break; | ||||||
|
|
||||||
| numbers.push(+value); | ||||||
|
|
||||||
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.
"subsums" virou "somas parciais" aqui e na linha 36, mas o
test.jsusa "subsoma", e a solução rápida (linha 66) usa "soma parcial" para outro conceito (partialSum, o acumulador que é zerado). O leitor pode confundir as duas ideias. Sugestão: usar "subsomas" de forma consistente.