From 0b66ed3443574270118203afd756df5579ea64d0 Mon Sep 17 00:00:00 2001 From: ednabarboza Date: Fri, 28 Oct 2022 07:58:09 -0300 Subject: [PATCH 01/10] feat(home):resolucao do exercicio1 --- 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..5c0279c 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}`; } -- 2.34.1 From 08b789490a194f63a45f6e43cf84b75f10cb063b Mon Sep 17 00:00:00 2001 From: ednabarboza Date: Fri, 28 Oct 2022 08:24:14 -0300 Subject: [PATCH 02/10] feat(home):resolucao da questao 2 --- 02-triangleArea/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/02-triangleArea/index.js b/02-triangleArea/index.js index 7628fcd..b204cee 100644 --- a/02-triangleArea/index.js +++ b/02-triangleArea/index.js @@ -1,3 +1,4 @@ export function triangleArea(base, height) { // your code here + return (base * height)/2 } \ No newline at end of file -- 2.34.1 From d53e5614be8ef15f2e2c21770484fb030c012bba Mon Sep 17 00:00:00 2001 From: ednabarboza Date: Fri, 28 Oct 2022 08:34:59 -0300 Subject: [PATCH 03/10] feat(home):resolucao da questao 3 --- 03-maxValue/index.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/03-maxValue/index.js b/03-maxValue/index.js index e433b31..a542f73 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,4 +1,12 @@ export function maxValue(values) { - // implementar logica aqui - -} \ No newline at end of file + //OBS: Questão foi realizada com função Math.max() que retorna o maior de um ou mais números. + //Referência: Usei como base o material descrito na página do Mozilla, + //disponível em: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Math/max + //Acesso em: 24/10/2022 + if(values.length === 0){ + return 0 + }else{ + return Math.max.apply(null, values); + } + + }; -- 2.34.1 From 1e3bee963ade964e4ec11def4006853fea3a6766 Mon Sep 17 00:00:00 2001 From: ednabarboza Date: Fri, 28 Oct 2022 08:49:35 -0300 Subject: [PATCH 04/10] feat(home):resolucao da questao 4 --- 04-fibonacci/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 37c64cc..4bf88fc 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,8 @@ export function fibonacci(value) { - // implementar logica aqui + //OBS: A questão foi resolvida usando a a fórmula de Binet e a proporção áurea + //Disponível em: https://pt.wikihow.com/Calcular-a-Sequ%C3%AAncia-de-Fibonacci + //Acesso em: 24/10/2022 + const number = (1.61803398875**value - (1-1.61803398875)**value)/5**0.5 + return parseInt(number); } \ No newline at end of file -- 2.34.1 From 58bc9ff8c6e6bb6084c3f3f4df6e6c0acac0f40e Mon Sep 17 00:00:00 2001 From: ednabarboza Date: Fri, 28 Oct 2022 08:58:26 -0300 Subject: [PATCH 05/10] feat(home): resolucao da questao 5 --- 05-isPrime/index.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/05-isPrime/index.js b/05-isPrime/index.js index ec9c4ac..c6f48e4 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,20 @@ export function isPrime(value) { // implementar logica aqui - + let prime = true + + if(value > 1){ + for(let i=2; i < value; i++){ + if(value % i === 0){ + prime = false + break; + } + } + if(prime === true){ + return true + }else{ + return false + } + }else{ + return false + } } \ No newline at end of file -- 2.34.1 From b24986f9ee0212c581f9a1a0849a1ddaacac73fe Mon Sep 17 00:00:00 2001 From: ednabarboza Date: Fri, 28 Oct 2022 09:05:51 -0300 Subject: [PATCH 06/10] feat(home):resolucao da questao 6 --- 06-sum/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/06-sum/index.js b/06-sum/index.js index ebc2ee1..04cd3b1 100644 --- a/06-sum/index.js +++ b/06-sum/index.js @@ -1,4 +1,9 @@ export function sum(values) { - // implementar logica aqui - + let inicio = 0 + + for(let i=0; i< values.length; i++){ + inicio = inicio + values[i] + } + return inicio + } \ No newline at end of file -- 2.34.1 From 070e878391b80875d27308abaf85777ea3de39db Mon Sep 17 00:00:00 2001 From: ednabarboza Date: Fri, 28 Oct 2022 09:10:49 -0300 Subject: [PATCH 07/10] feat(home):resolucao da questao 7 --- 07-sumEven/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/07-sumEven/index.js b/07-sumEven/index.js index bb1e095..15d7425 100644 --- a/07-sumEven/index.js +++ b/07-sumEven/index.js @@ -1,4 +1,12 @@ export function sumEven(value) { - // implementar logica aqui + let inicio = 0 + + for(let i=0; i< value.length; i++){ + if(value[i] % 2 === 0){ + inicio = inicio + value[i] + } + + } + return inicio } \ No newline at end of file -- 2.34.1 From 446222dffb3d45e3822cbedc96815fd5d8ec149d Mon Sep 17 00:00:00 2001 From: ednabarboza Date: Fri, 28 Oct 2022 09:16:25 -0300 Subject: [PATCH 08/10] feat(home): resolucao da questao 8 --- 08-isAnagram/index.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/08-isAnagram/index.js b/08-isAnagram/index.js index 918308a..9c950e1 100644 --- a/08-isAnagram/index.js +++ b/08-isAnagram/index.js @@ -1,4 +1,18 @@ export function isAnagram(word1, word2) { - // implementar logica aqui + let arrayTest = word1.toLowerCase().split('').sort(); + let arrayOriginal = word2.toLowerCase().split('').sort(); + + let palavraTest = arrayTest.toString(); + let palavraOriginal = arrayOriginal.toString(); + + if(arrayTest.length === arrayOriginal.length){ + if(palavraTest === palavraOriginal){ + return true + }else{ + return false + } + }else{ + return false + } } \ No newline at end of file -- 2.34.1 From 1ef4c3dd94c48141784259db576a68674f4d640c Mon Sep 17 00:00:00 2001 From: ednabarboza Date: Fri, 28 Oct 2022 09:20:54 -0300 Subject: [PATCH 09/10] feat(home):resolucao da questao 9 --- 09-mostRepeatedChar/index.js | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/09-mostRepeatedChar/index.js b/09-mostRepeatedChar/index.js index b113ed8..eda93a8 100644 --- a/09-mostRepeatedChar/index.js +++ b/09-mostRepeatedChar/index.js @@ -1,4 +1,27 @@ export function mostUsedChar(text) { - // implementar logica aqui - return "" + let order = text.toLowerCase().split('').sort(); + + let finalResult = ""; + let letterMostAppears = 0; + + + //console.log(order) ---> verificar se transformou em array e ordenou + + for(let i=0; i letterMostAppears){ + letterMostAppears = count; + finalResult = order[i]; + } + + } + return finalResult; } \ No newline at end of file -- 2.34.1 From dc63a2e8e388d622c6f00a10d8961a6beff03132 Mon Sep 17 00:00:00 2001 From: ednabarboza Date: Fri, 28 Oct 2022 23:56:06 -0300 Subject: [PATCH 10/10] feat(home):resolucao da questao 10 --- 10-longestWords/index.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/10-longestWords/index.js b/10-longestWords/index.js index a98d2d8..954ac9b 100644 --- a/10-longestWords/index.js +++ b/10-longestWords/index.js @@ -1,4 +1,20 @@ export function longestWords(words) { - // implementar logica aqui - -} \ No newline at end of file + let allArray = []; + let longest = []; + for (let i=0; i