chore(i18n,curriculum): update translations (#43375)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5e4ce2eaac708cc68c1df260
|
||||
title: Levenshtein distance
|
||||
title: Distância de Levenshtein
|
||||
challengeType: 5
|
||||
forumTopicId: 385264
|
||||
dashedName: levenshtein-distance
|
||||
@@ -8,71 +8,71 @@ dashedName: levenshtein-distance
|
||||
|
||||
# --description--
|
||||
|
||||
In information theory and computer science, the **Levenshtein distance** is a [metric](https://en.wikipedia.org/wiki/string metric) for measuring the amount of difference between two sequences (i.e. an [edit distance](https://en.wikipedia.org/wiki/edit distance)). The Levenshtein distance between two strings is defined as the minimum number of edits needed to transform one string into the other, with the allowable edit operations being insertion, deletion, or substitution of a single character.
|
||||
Em teoria da informação e em ciência da computação, a **distância de Levenshtein** é uma [medida](https://en.wikipedia.org/wiki/string metric) para estimar o valor da diferença entre duas sequências (ou seja, uma [distância de edição](https://en.wikipedia.org/wiki/edit distance)). A distância de Levenshtein entre duas strings é definida como o número mínimo de edições necessárias para transformar uma sequência de caracteres em outra, com as operações de edição permitidas sendo inserção, exclusão ou substituição de um único caractere.
|
||||
|
||||
Example:
|
||||
Exemplo:
|
||||
|
||||
The Levenshtein distance between "**kitten**" and "**sitting**" is 3, since the following three edits change one into the other, and there isn't a way to do it with fewer than three edits:
|
||||
A distância de Levenshtein entre "**kitten**" e "**sitting**" é 3, já que as três edições a seguir mudam de uma palavra para a outra e não há modo de fazer isso com menos de três edições:
|
||||
|
||||
<ul>
|
||||
<li><strong>k</strong>itten <strong>s</strong>itten (substitution of 'k' with 's')</li>
|
||||
<li>sitt<strong>e</strong>n sitt<strong>i</strong>n (substitution of 'e' with 'i')</li>
|
||||
<li>sittin sittin<strong>g</strong> (insert 'g' at the end).</li>
|
||||
<li><strong>k</strong>itten <strong>s</strong>itten (substituição do 'k' pelo 's')</li>
|
||||
<li>sitt<strong>e</strong>n sitt<strong>i</strong>n (substituição do 'e' pelo 'i')</li>
|
||||
<li>sittin sittin<strong>g</strong> (inserção de 'g' ao final).</li>
|
||||
</ul>
|
||||
|
||||
*The Levenshtein distance between "**rosettacode**", "**raisethysword**" is **8**.*
|
||||
*A distância de Levenshtein entre "**rosettacode**" e "**raisethysword**" é de **8**.*
|
||||
|
||||
*The distance between two strings is same as that when both strings are reversed.*
|
||||
*A distância entre duas strings é a mesma que aquela quando ambas as strings são invertidas.*
|
||||
|
||||
# --instructions--
|
||||
|
||||
Write a function that returns the Levenshtein distance between two strings given as parameters.
|
||||
Escreva uma função que retorne a distância de Levenshtein entre duas strings dadas como parâmetros.
|
||||
|
||||
# --hints--
|
||||
|
||||
`levenshtein` should be a function.
|
||||
`levenshtein` deve ser uma função.
|
||||
|
||||
```js
|
||||
assert(typeof levenshtein == 'function');
|
||||
```
|
||||
|
||||
`levenshtein("mist", "dist")` should return a number.
|
||||
`levenshtein("mist", "dist")` deve retornar um número.
|
||||
|
||||
```js
|
||||
assert(typeof levenshtein('mist', 'dist') == 'number');
|
||||
```
|
||||
|
||||
`levenshtein("mist", "dist")` should return `1`.
|
||||
`levenshtein("mist", "dist")` deve retornar `1`.
|
||||
|
||||
```js
|
||||
assert.equal(levenshtein('mist', 'dist'), 1);
|
||||
```
|
||||
|
||||
`levenshtein("tier", "tor")` should return `2`.
|
||||
`levenshtein("tier", "tor")` deve retornar `2`.
|
||||
|
||||
```js
|
||||
assert.equal(levenshtein('tier', 'tor'), 2);
|
||||
```
|
||||
|
||||
`levenshtein("kitten", "sitting")` should return `3`.
|
||||
`levenshtein("kitten", "sitting")` deve retornar `3`.
|
||||
|
||||
```js
|
||||
assert.equal(levenshtein('kitten', 'sitting'), 3);
|
||||
```
|
||||
|
||||
`levenshtein("stop", "tops")` should return `2`.
|
||||
`levenshtein("stop", "tops")` deve retornar `2`.
|
||||
|
||||
```js
|
||||
assert.equal(levenshtein('stop', 'tops'), 2);
|
||||
```
|
||||
|
||||
`levenshtein("rosettacode", "raisethysword")` should return `8`.
|
||||
`levenshtein("rosettacode", "raisethysword")` deve retornar `8`.
|
||||
|
||||
```js
|
||||
assert.equal(levenshtein('rosettacode', 'raisethysword'), 8);
|
||||
```
|
||||
|
||||
`levenshtein("mississippi", "swiss miss")` should return `8`.
|
||||
`levenshtein("mississippi", "swiss miss")` deve retornar `8`.
|
||||
|
||||
```js
|
||||
assert.equal(levenshtein('mississippi', 'swiss miss'), 8);
|
||||
|
Reference in New Issue
Block a user