chore(i18n,curriculum): processed translations (#43361)
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5951ed8945deab770972ae56
|
||||
title: Towers of Hanoi
|
||||
title: Torres de Hanói
|
||||
challengeType: 5
|
||||
forumTopicId: 302341
|
||||
dashedName: towers-of-hanoi
|
||||
@ -8,41 +8,41 @@ dashedName: towers-of-hanoi
|
||||
|
||||
# --description--
|
||||
|
||||
Solve the [Towers of Hanoi](https://en.wikipedia.org/wiki/Towers_of_Hanoi "wp: Towers_of_Hanoi") problem.
|
||||
Resolva o problema das [Torres de Hanói](https://pt.wikipedia.org/wiki/Torre_de_Han%C3%B3i "wp: Torres_de_Hanoi").
|
||||
|
||||
Your solution should accept the number of discs as the first parameters, and three string used to identify each of the three stacks of discs, for example `towerOfHanoi(4, 'A', 'B', 'C')`. The function should return an array of arrays containing the list of moves, source -> destination.
|
||||
Sua solução deve aceitar o número de discos como os primeiros parâmetros, e três strings usadas para identificar cada uma das três pilhas de discos, por exemplo `towerOfHanoi(4, 'A', 'B', 'C')`. A função deve retornar um array de arrays contendo a lista de movimentos, origem -> destino.
|
||||
|
||||
For example, the array `[['A', 'C'], ['B', 'A']]` indicates that the 1st move was to move a disc from stack A to C, and the 2nd move was to move a disc from stack B to A.
|
||||
Por exemplo, o array `[['A', 'C'], ['B', 'A']]` indica que o primeiro movimento foi mover um disco da pilha A para C, e o segundo movimento foi para mover um disco da pilha B para A.
|
||||
|
||||
<p></p>
|
||||
|
||||
# --hints--
|
||||
|
||||
`towerOfHanoi` should be a function.
|
||||
`towerOfHanoi` deve ser uma função.
|
||||
|
||||
```js
|
||||
assert(typeof towerOfHanoi === 'function');
|
||||
```
|
||||
|
||||
`towerOfHanoi(3, ...)` should return 7 moves.
|
||||
`towerOfHanoi(3, ...)` deve retornar 7 movimentos.
|
||||
|
||||
```js
|
||||
assert(res3.length === 7);
|
||||
```
|
||||
|
||||
`towerOfHanoi(3, 'A', 'B', 'C')` should return `[['A','B'], ['A','C'], ['B','C'], ['A','B'], ['C','A'], ['C','B'], ['A','B']]`.
|
||||
`towerOfHanoi(3, 'A', 'B', 'C')` deve retornar `[['A','B'], ['A','C'], ['B','C'], ['A','B'], ['C','A'], ['C','B'], ['A','B']]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(towerOfHanoi(3, 'A', 'B', 'C'), res3Moves);
|
||||
```
|
||||
|
||||
`towerOfHanoi(5, "X", "Y", "Z")` 10th move should be Y -> X.
|
||||
O décimo movimento da `towerOfHanoi(5, "X", "Y", "Z")` deve ser Y -> X.
|
||||
|
||||
```js
|
||||
assert.deepEqual(res5[9], ['Y', 'X']);
|
||||
```
|
||||
|
||||
`towerOfHanoi(7, 'A', 'B', 'C')` first ten moves should be `[['A','B'], ['A','C'], ['B','C'], ['A','B'], ['C','A'], ['C','B'], ['A','B'], ['A','C'], ['B','C'], ['B','A']]`
|
||||
Os dez primeiros movimentos da `towerOfHanoi(7, 'A', 'B', 'C')` devem ser `[['A','B'], ['A','C'], ['B','C'], ['A','B'], ['C','A'], ['C','B'], ['A','B'], ['A','C'], ['B','C'], ['B','A']]`
|
||||
|
||||
```js
|
||||
assert.deepEqual(towerOfHanoi(7, 'A', 'B', 'C').slice(0, 10), res7First10Moves);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5e94a54cc7b022105bf0fd2c
|
||||
title: Word frequency
|
||||
title: Frequência de palavras
|
||||
challengeType: 5
|
||||
forumTopicId: 393913
|
||||
dashedName: word-frequency
|
||||
@ -8,68 +8,68 @@ dashedName: word-frequency
|
||||
|
||||
# --description--
|
||||
|
||||
Given a text string and an integer n, return the n most common words in the file (and the number of their occurrences) in decreasing frequency.
|
||||
Dados uma string e um número inteiro n, retorne as n palavras mais comuns no arquivo (e o número de ocorrências de cada uma) em frequência decrescente.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Write a function to count the occurrences of each word and return the n most commons words along with the number of their occurences in decreasing frequency.
|
||||
Escreva uma função para contar as ocorrências de cada palavra e retornar as n palavras mais comuns junto com o número de suas ocorrências em frequência decrescente.
|
||||
|
||||
The function should return a 2D array with each of the elements in the following form: `[word, freq]`. `word` should be the lowercase version of the word and `freq` the number denoting the count.
|
||||
A função deve retornar um array 2D com cada um dos elementos na seguinte forma: `[word, freq]`. `word` deve ser a palavra toda em minúscula e `freq` o número que indica a contagem.
|
||||
|
||||
The function should return an empty array, if no string is provided.
|
||||
A função deve retornar um array vazio se nenhuma string for fornecida.
|
||||
|
||||
The function should be case insensitive, for example, the strings "Hello" and "hello" should be treated the same.
|
||||
A função não deve diferenciar maiúsculas de minúsculas. As strings "Hello" e "hello", por exemplo, devem ser tratadas da mesma forma.
|
||||
|
||||
You can treat words that have special characters such as underscores, dashes, apostrophes, commas, etc., as distinct words.
|
||||
Você pode tratar as palavras com caracteres especiais como sublinhados, traços, apóstrofes, vírgulas, etc., como palavras distintas.
|
||||
|
||||
For example, given the string "Hello hello goodbye", your function should return `[['hello', 2], ['goodbye', 1]]`.
|
||||
Por exemplo, dada a string "Hello Hello goodbye", sua função deve retornar `[['hello', 2], ['goodbye', 1]]`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`wordFrequency` should be a function.
|
||||
`wordFrequency` deve ser uma função.
|
||||
|
||||
```js
|
||||
assert(typeof wordFrequency == 'function');
|
||||
```
|
||||
|
||||
`wordFrequency` should return an array.
|
||||
`wordFrequency` deve retornar um array.
|
||||
|
||||
```js
|
||||
assert(Array.isArray(wordFrequency('test')));
|
||||
```
|
||||
|
||||
`wordFrequency("Hello hello world", 2)` should return `[['hello', 2], ['world', 1]]`
|
||||
`wordFrequency("Hello hello world", 2)` deve retornar `[['hello', 2], ['world', 1]]`
|
||||
|
||||
```js
|
||||
assert.deepEqual(wordFrequency(example_1, 2), example_1_solution);
|
||||
```
|
||||
|
||||
`wordFrequency("The quick brown fox jumped over the lazy dog", 1)` should return `[['the', 2]]`
|
||||
`wordFrequency("The quick brown fox jumped over the lazy dog", 1)` deve retornar `[['the', 2]]`
|
||||
|
||||
```js
|
||||
assert.deepEqual(wordFrequency(example_2, 1), example_2_solution);
|
||||
```
|
||||
|
||||
`wordFrequency("Opensource opensource open-source open source", 1)` should return `[['opensource', 2]]`
|
||||
`wordFrequency("Opensource opensource open-source open source", 1)` deve retornar `[['opensource', 2]]`
|
||||
|
||||
```js
|
||||
assert.deepEqual(wordFrequency(example_3, 1), example_3_solution);
|
||||
```
|
||||
|
||||
`wordFrequency("Apple App apply aPP aPPlE", 3)` should return `[['app', 2], ['apple', 2], ['apply', 1]]` or `[['apple', 2], ['app', 2], ['apply', 1]]`
|
||||
`wordFrequency("Apple App apply aPP aPPlE", 3)` deve retornar `[['app', 2], ['apple', 2], ['apply', 1]]` ou `[['apple', 2], ['app', 2], ['apply', 1]]`
|
||||
|
||||
```js
|
||||
const arr = JSON.stringify(wordFrequency(example_4, 3));
|
||||
assert(arr === example_4_solution_a || arr === example_4_solution_b);
|
||||
```
|
||||
|
||||
`wordFrequency("c d a d c a b d d c", 4)` should return `[['d', 4], ['c', 3], ['a', 2], ['b', 1]]`
|
||||
`wordFrequency("c d a d c a b d d c", 4)` deve retornar `[['d', 4], ['c', 3], ['a', 2], ['b', 1]]`
|
||||
|
||||
```js
|
||||
assert.deepEqual(wordFrequency(example_5, 4), example_5_solution);
|
||||
```
|
||||
|
||||
`wordFrequency("", 5)` should return `[]`
|
||||
`wordFrequency("", 5)` deve retornar `[]`
|
||||
|
||||
```js
|
||||
assert.deepEqual(wordFrequency(example_6, 5), example_6_solution);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 594810f028c0303b75339ad4
|
||||
title: Word wrap
|
||||
title: Quebra de linha
|
||||
challengeType: 5
|
||||
forumTopicId: 302344
|
||||
dashedName: word-wrap
|
||||
@ -8,52 +8,51 @@ dashedName: word-wrap
|
||||
|
||||
# --description--
|
||||
|
||||
Even today, with proportional fonts and complex layouts, there are still cases where you need to wrap text at a specified column. The basic task is to wrap a paragraph of text in a simple way.
|
||||
Mesmo hoje, com fontes proporcionais e layouts complexos, ainda há casos em que você precisa quebrar o texto em uma determinada coluna. A tarefa básica é quebrar um parágrafo de um texto de uma forma simples.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Write a function that can wrap this text to any number of characters. As an example, the text wrapped to 80 characters should look like the following:
|
||||
Escreva uma função que possa quebrar este texto para qualquer número de caracteres. Como exemplo, o texto quebrado com 80 caracteres deve se parecer com o seguinte:
|
||||
|
||||
<pre>
|
||||
Wrap text using a more sophisticated algorithm such as the Knuth and Plass TeX
|
||||
algorithm. If your language provides this, you get easy extra credit, but you
|
||||
must reference documentation indicating that the algorithm is something better
|
||||
than a simple minimum length algorithm.
|
||||
Quebre o texto usando um algoritmo mais sofisticado, como o algoritmo de Knuth e Plass TeX. Se o seu idioma fornece isso, você obtém crédito extra fácil, mas você
|
||||
deve fazer referência à documentação que indica que o algoritmo é algo melhor
|
||||
do que um simples algoritmo de comprimento mínimo.
|
||||
</pre>
|
||||
|
||||
# --hints--
|
||||
|
||||
wrap should be a function.
|
||||
wrap deve ser uma função.
|
||||
|
||||
```js
|
||||
assert.equal(typeof wrap, 'function');
|
||||
```
|
||||
|
||||
wrap should return a string.
|
||||
wrap deve retornar uma string.
|
||||
|
||||
```js
|
||||
assert.equal(typeof wrap('abc', 10), 'string');
|
||||
```
|
||||
|
||||
wrap(80) should return 4 lines.
|
||||
wrap(80) deve retornar 4 linhas.
|
||||
|
||||
```js
|
||||
assert(wrapped80.split('\n').length === 4);
|
||||
```
|
||||
|
||||
Your `wrap` function should return our expected text.
|
||||
Sua função `wrap` deve retornar nosso texto esperado.
|
||||
|
||||
```js
|
||||
assert.equal(wrapped80.split('\n')[0], firstRow80);
|
||||
```
|
||||
|
||||
wrap(42) should return 7 lines.
|
||||
wrap(42) deve retornar 7 linhas.
|
||||
|
||||
```js
|
||||
assert(wrapped42.split('\n').length === 7);
|
||||
```
|
||||
|
||||
Your `wrap` function should return our expected text.
|
||||
A função `wrap` deve retornar nosso texto esperado.
|
||||
|
||||
```js
|
||||
assert.equal(wrapped42.split('\n')[0], firstRow42);
|
||||
|
Reference in New Issue
Block a user