From 0cb25ef0fd6b7ee7da631a46e3636b4ca1f67268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorena=20Camila=20Coelho=20M=C3=A1ximo?= Date: Sat, 29 Oct 2022 18:15:48 -0400 Subject: [PATCH 01/10] =?UTF-8?q?feat(greeting):=20desenvolvimento=20da=20?= =?UTF-8?q?fun=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 01-greeting/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/01-greeting/index.js b/01-greeting/index.js index 8f551af..c1211f1 100644 --- a/01-greeting/index.js +++ b/01-greeting/index.js @@ -1,4 +1,4 @@ export function greet(name) { // implementar logica aqui - return ""; + return "Hello " + name; } From 1c644ea8c4fb710c016cca6f511557c54e509b32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorena=20Camila=20Coelho=20M=C3=A1ximo?= Date: Sat, 29 Oct 2022 18:23:45 -0400 Subject: [PATCH 02/10] =?UTF-8?q?feat(triangleArea):=20desenvolvimento=20d?= =?UTF-8?q?a=20fun=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 02-triangleArea/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/02-triangleArea/index.js b/02-triangleArea/index.js index 7628fcd..2c14ebf 100644 --- a/02-triangleArea/index.js +++ b/02-triangleArea/index.js @@ -1,3 +1,3 @@ export function triangleArea(base, height) { - // your code here + return (base*height)/2 } \ No newline at end of file From 8726038394ede68eed68039fe5dc845faa1f2253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorena=20Camila=20Coelho=20M=C3=A1ximo?= Date: Sat, 29 Oct 2022 20:23:20 -0400 Subject: [PATCH 03/10] =?UTF-8?q?feat(maxValue):=20desenvolvimento=20da=20?= =?UTF-8?q?fun=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 03-maxValue/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/03-maxValue/index.js b/03-maxValue/index.js index e433b31..3e8ba6b 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,4 +1,4 @@ export function maxValue(values) { // implementar logica aqui - + return values?.length ? Math.max(...values) : 0 } \ No newline at end of file From 2d8af96a28e129f94066c0e572ddfc086e36484f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorena=20Camila=20Coelho=20M=C3=A1ximo?= Date: Sat, 29 Oct 2022 20:32:37 -0400 Subject: [PATCH 04/10] =?UTF-8?q?feat(fibonacci):=20desenvolvimento=20da?= =?UTF-8?q?=20fun=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 04-fibonacci/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 37c64cc..437e081 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,13 @@ export function fibonacci(value) { // implementar logica aqui - + let resultado = 0 + let anterior = 0 + let proximo = 1 + + for (let i = 0; i < value; i++) { + resultado = anterior + proximo + anterior = proximo + proximo = resultado + } + return anterior } \ No newline at end of file From a7dff396b4205c58b6d1bf3f100d2c1a1bdc0b9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorena=20Camila=20Coelho=20M=C3=A1ximo?= Date: Mon, 31 Oct 2022 22:51:10 -0400 Subject: [PATCH 05/10] =?UTF-8?q?feat(isPrime):=20desenvolvimento=20da=20f?= =?UTF-8?q?un=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 05-isPrime/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/05-isPrime/index.js b/05-isPrime/index.js index ec9c4ac..b01adbe 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,9 @@ export function isPrime(value) { // implementar logica aqui - + for (let i = 2; i < value; i++) + if (value % i === 0) { + return false; + } + + return value > 1 } \ No newline at end of file From ff22b86c9808620edaa3eefcde40041b2271e0cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorena=20Camila=20Coelho=20M=C3=A1ximo?= Date: Tue, 1 Nov 2022 00:18:35 -0400 Subject: [PATCH 06/10] =?UTF-8?q?feat(sum):=20desenvolvimento=20da=20fun?= =?UTF-8?q?=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 06-sum/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/06-sum/index.js b/06-sum/index.js index ebc2ee1..6828051 100644 --- a/06-sum/index.js +++ b/06-sum/index.js @@ -1,4 +1,9 @@ export function sum(values) { // implementar logica aqui - + let total = 0; + for (let i = 0; i < values.length; i++) { + total += values[i] + } + return total + /* return values.reduce((acumulador, valorAtual) => acumulador + valorAtual, 0) */ } \ No newline at end of file From 60c42f40223361e8f95f54bbf82021909e346dde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorena=20Camila=20Coelho=20M=C3=A1ximo?= Date: Tue, 1 Nov 2022 00:42:23 -0400 Subject: [PATCH 07/10] =?UTF-8?q?feat(sumEven):=20desenvolvimento=20da=20f?= =?UTF-8?q?un=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 07-sumEven/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/07-sumEven/index.js b/07-sumEven/index.js index bb1e095..bd20228 100644 --- a/07-sumEven/index.js +++ b/07-sumEven/index.js @@ -1,4 +1,10 @@ export function sumEven(value) { // implementar logica aqui - + let total = 0; + for (let i = 0; i < value.length; i++) { + if (value[i] % 2 === 0) { + total += value[i]; + } + } + return total } \ No newline at end of file From bb4c1d413368bbaef4b9f21b94e6a904a7bd34a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorena=20Camila=20Coelho=20M=C3=A1ximo?= Date: Wed, 2 Nov 2022 14:29:26 -0400 Subject: [PATCH 08/10] =?UTF-8?q?feat(isAnagram):=20desenvolviomento=20da?= =?UTF-8?q?=20fun=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 08-isAnagram/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/08-isAnagram/index.js b/08-isAnagram/index.js index 918308a..9e5b929 100644 --- a/08-isAnagram/index.js +++ b/08-isAnagram/index.js @@ -1,4 +1,4 @@ export function isAnagram(word1, word2) { // implementar logica aqui - + return word1.length !== word2.length ? false : word1.toLowerCase().split('').sort().join('') === word2.toLowerCase().split('').sort().join('') } \ No newline at end of file From 6b77ba45d68da25b2764cc84f883b79ee9d13085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorena=20Camila=20Coelho=20M=C3=A1ximo?= Date: Wed, 2 Nov 2022 19:46:01 -0400 Subject: [PATCH 09/10] =?UTF-8?q?feat(mostRepeatedChar):=20desenvolvimento?= =?UTF-8?q?=20da=20fun=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 09-mostRepeatedChar/index.js | 7 ++++++- 09-mostRepeatedChar/readme.md | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/09-mostRepeatedChar/index.js b/09-mostRepeatedChar/index.js index b113ed8..bcd485e 100644 --- a/09-mostRepeatedChar/index.js +++ b/09-mostRepeatedChar/index.js @@ -1,4 +1,9 @@ export function mostUsedChar(text) { // implementar logica aqui - return "" + let strObj = {} + return text.replaceAll(' ', '').toLowerCase().split('').reduce( + (letraAnterior, letraAtual) => { + strObj[letraAtual] = strObj[letraAtual] + 1 || 1 + return strObj[letraAnterior] > strObj[letraAtual] ? letraAnterior : letraAtual + }) } \ No newline at end of file diff --git a/09-mostRepeatedChar/readme.md b/09-mostRepeatedChar/readme.md index da43b50..60f3914 100644 --- a/09-mostRepeatedChar/readme.md +++ b/09-mostRepeatedChar/readme.md @@ -1,6 +1,6 @@ # Desafio 04: caractere mais repetido -Faça um algoritmo que retorne a a letra mias repetida de uma string +Faça um algoritmo que retorne a letra mais repetida de uma string ## Exemplo From 94be808888a56cc13778589e16580e683f8e4e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorena=20Camila=20Coelho=20M=C3=A1ximo?= Date: Wed, 2 Nov 2022 20:51:03 -0400 Subject: [PATCH 10/10] =?UTF-8?q?feat(longestWords:=20desenvolvimento=20da?= =?UTF-8?q?=20fun=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 10-longestWords/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/10-longestWords/index.js b/10-longestWords/index.js index a98d2d8..56ad614 100644 --- a/10-longestWords/index.js +++ b/10-longestWords/index.js @@ -1,4 +1,11 @@ export function longestWords(words) { // implementar logica aqui - + return words.reduce((acumulador, palavraAtual) => { + if (!acumulador.length) acumulador = [palavraAtual]; + else if (palavraAtual.length > acumulador[0].length) + acumulador = [palavraAtual]; + else if (palavraAtual.length === acumulador[0].length) + acumulador = [...acumulador, palavraAtual]; + return acumulador; + }, []) } \ No newline at end of file