chore(i18n,curriculum): update translations (#42976)

This commit is contained in:
camperbot
2021-07-23 00:41:52 +05:30
committed by GitHub
parent c7fb462b4a
commit 368a6ebf7c
11 changed files with 90 additions and 91 deletions

View File

@ -1,6 +1,6 @@
---
id: 8d5123c8c441eddfaeb5bdef
title: Implement Bubble Sort
title: Implementare Bubble Sort
challengeType: 1
forumTopicId: 301612
dashedName: implement-bubble-sort
@ -8,23 +8,23 @@ dashedName: implement-bubble-sort
# --description--
This is the first of several challenges on sorting algorithms. Given an array of unsorted items, we want to be able to return a sorted array. We will see several different methods to do this and learn some tradeoffs between these different approaches. While most modern languages have built-in sorting methods for operations like this, it is still important to understand some of the common basic approaches and learn how they can be implemented.
Questa è la prima di diverse sfide sugli algoritmi di ordinamento. Dato un array di elementi non ordinati, vogliamo essere in grado di restituire un array ordinato. Vedremo diversi metodi per farlo e impareremo alcuni compromessi tra questi diversi approcci. Mentre la maggior parte dei linguaggi moderni ha integrato metodi di ordinamento per operazioni come questa, è ancora importante comprendere alcuni degli approcci di base comuni e imparare come possono essere attuati.
Here we will see bubble sort. The bubble sort method starts at the beginning of an unsorted array and 'bubbles up' unsorted values towards the end, iterating through the array until it is completely sorted. It does this by comparing adjacent items and swapping them if they are out of order. The method continues looping through the array until no swaps occur at which point the array is sorted.
Qui vedremo il Bubble Sort. Il metodo di ordinamento Bubble Sort comincia all'inizio di un array non ordinato e 'porta a galla' i valori non ordinati verso la fine, iterando attraverso l'array fino a quando non è completamente ordinato. Lo fa confrontando gli elementi adiacenti e scambiandoli se sono fuori ordine. Il metodo continua a iterare attraverso l'array fino a quando non si verificano più scambi: a quel punto l'array è ordinato.
This method requires multiple iterations through the array and for average and worst cases has quadratic time complexity. While simple, it is usually impractical in most situations.
Questo metodo richiede iterazioni multiple attraverso l'array e per i casi medi e peggiori ha complessità di tempo quadratica. Per quanto semplice, è poco pratico nella maggior parte delle situazioni.
**Instructions:** Write a function `bubbleSort` which takes an array of integers as input and returns an array of these integers in sorted order from least to greatest.
**Istruzioni:** Scrivi una funzione `bubbleSort` che prende un array di interi come input e restituisce un array di questi interi in ordine dal più piccolo al più grande.
# --hints--
`bubbleSort` should be a function.
`bubbleSort` dovrebbe essere una funzione.
```js
assert(typeof bubbleSort == 'function');
```
`bubbleSort` should return a sorted array (least to greatest).
`bubbleSort` dovrebbe restituire un array ordinato (dal più piccolo al più grande).
```js
assert(
@ -52,7 +52,7 @@ assert(
);
```
`bubbleSort` should return an array that is unchanged except for order.
`bubbleSort([1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92])` dovrebbe restituire un array invariato tranne che per l'ordine.
```js
assert.sameMembers(
@ -79,7 +79,7 @@ assert.sameMembers(
);
```
`bubbleSort` should not use the built-in `.sort()` method.
`bubbleSort` non dovrebbe usare il metodo integrato `.sort()`.
```js
assert(isBuiltInSortUsed());
@ -113,8 +113,6 @@ function bubbleSort(array) {
return array;
// Only change code above this line
}
bubbleSort([1, 4, 2, 8, 345, 123, 43, 32, 5643, 63, 123, 43, 2, 55, 1, 234, 92]);
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: a7bf700cd123b9a54eef01d5
title: No Repeats Please
title: Nessuna ripetizione per favore
challengeType: 5
forumTopicId: 16037
dashedName: no-repeats-please
@ -8,67 +8,67 @@ dashedName: no-repeats-please
# --description--
Return the number of total permutations of the provided string that don't have repeated consecutive letters. Assume that all characters in the provided string are each unique.
Restituisci il numero di permutazioni totali della stringa fornita che non hanno lettere consecutive ripetute. Supponiamo che tutti i caratteri della stringa fornita siano univoci.
For example, `aab` should return 2 because it has 6 total permutations (`aab`, `aab`, `aba`, `aba`, `baa`, `baa`), but only 2 of them (`aba` and `aba`) don't have the same letter (in this case `a`) repeating.
Ad esempio, `aab` dovrebbe restituire 2 perché ha 6 permutazioni totali (`aab`, `aab`, `aba`, `aba`, `baa`, `baa`), ma solo 2 di loro (`aba` e `aba`) non hanno la stessa lettera (in questo caso `a`) ripetuta.
# --hints--
`permAlone("aab")` should return a number.
`permAlone("aab")` dovrebbe restituire un numero.
```js
assert.isNumber(permAlone('aab'));
```
`permAlone("aab")` should return 2.
`permAlone("aab")` dovrebbe restituire 2.
```js
assert.strictEqual(permAlone('aab'), 2);
```
`permAlone("aaa")` should return 0.
`permAlone("aaa")` dovrebbe restituire 0.
```js
assert.strictEqual(permAlone('aaa'), 0);
```
`permAlone("aabb")` should return 8.
`permAlone("aabb")` dovrebbe restituire 8.
```js
assert.strictEqual(permAlone('aabb'), 8);
```
`permAlone("abcdefa")` should return 3600.
`permAlone("abcdefa")` dovrebbe restituire 3600.
```js
assert.strictEqual(permAlone('abcdefa'), 3600);
```
`permAlone("abfdefa")` should return 2640.
`permAlone("abfdefa")` dovrebbe restituire 2640.
```js
assert.strictEqual(permAlone('abfdefa'), 2640);
```
`permAlone("zzzzzzzz")` should return 0.
`permAlone("zzzzzzzz")` dovrebbe restituire 0.
```js
assert.strictEqual(permAlone('zzzzzzzz'), 0);
```
`permAlone("a")` should return 1.
`permAlone("a")` dovrebbe restituire 1.
```js
assert.strictEqual(permAlone('a'), 1);
```
`permAlone("aaab")` should return 0.
`permAlone("aaab")` dovrebbe restituire 0.
```js
assert.strictEqual(permAlone('aaab'), 0);
```
`permAlone("aaabb")` should return 12.
`permAlone("aaabb")` dovrebbe restituire 12.
```js
assert.strictEqual(permAlone('aaabb'), 12);

View File

@ -1,6 +1,6 @@
---
id: a3f503de51cfab748ff001aa
title: Pairwise
title: A coppie
challengeType: 5
forumTopicId: 301617
dashedName: pairwise
@ -8,11 +8,11 @@ dashedName: pairwise
# --description--
Given an array `arr`, find element pairs whose sum equal the second argument `arg` and return the sum of their indices.
Dato un array `arr`, trova coppie di elementi la cui somma è uguale al secondo argomento `arg` e restituisci la somma dei loro indici.
You may use multiple pairs that have the same numeric elements but different indices. Each pair should use the lowest possible available indices. Once an element has been used it cannot be reused to pair with another element. For instance, `pairwise([1, 1, 2], 3)` creates a pair `[2, 1]` using the 1 at index 0 rather than the 1 at index 1, because 0+2 < 1+2.
È possibile utilizzare più coppie che hanno gli stessi elementi numerici ma indici diversi. Ogni coppia dovrebbe utilizzare i più bassi indici disponibili. Una volta che un elemento è stato usato, non può essere riutilizzato per accoppiarsi con un altro elemento. Per esempio, `pairwise([1, 1, 2], 3)` crea una coppia `[2, 1]` usando l1 allindice 0 piuttosto che l1 allindice 1, perché 0+2 < 1+2.
For example `pairwise([7, 9, 11, 13, 15], 20)` returns `6`. The pairs that sum to 20 are `[7, 13]` and `[9, 11]`. We can then write out the array with their indices and values.
Per esempio `pairwise([7, 9, 11, 13, 15], 20)` restituisce `6`. Le coppie la cui somma è 20 sono `[7, 13]` e `[9, 11]`. Possiamo poi scrivere l'array con i loro indici e valori.
<div style='margin-left: 2em;'>
@ -22,7 +22,7 @@ For example `pairwise([7, 9, 11, 13, 15], 20)` returns `6`. The pairs that sum t
</div>
Below we'll take their corresponding indices and add them.
Qui sotto prenderemo i loro indici corrispondenti e ne faremo la somma.
<div style='margin-left: 2em;'>
@ -34,31 +34,31 @@ Below we'll take their corresponding indices and add them.
# --hints--
`pairwise([1, 4, 2, 3, 0, 5], 7)` should return 11.
`pairwise([1, 4, 2, 3, 0, 5], 7)` dovrebbe restituire 11.
```js
assert.deepEqual(pairwise([1, 4, 2, 3, 0, 5], 7), 11);
```
`pairwise([1, 3, 2, 4], 4)` should return 1.
`pairwise([1, 3, 2, 4], 4)` dovrebbe restituire 1.
```js
assert.deepEqual(pairwise([1, 3, 2, 4], 4), 1);
```
`pairwise([1, 1, 1], 2)` should return 1.
`pairwise([1, 1, 1], 2)` dovrebbe restituire 1.
```js
assert.deepEqual(pairwise([1, 1, 1], 2), 1);
```
`pairwise([0, 0, 0, 0, 1, 1], 1)` should return 10.
`pairwise([0, 0, 0, 0, 1, 1], 1)` dovrebbe restituire 10.
```js
assert.deepEqual(pairwise([0, 0, 0, 0, 1, 1], 1), 10);
```
`pairwise([], 100)` should return 0.
`pairwise([], 100)` dovrebbe restituire 0.
```js
assert.deepEqual(pairwise([], 100), 0);