From 57b1ccfaacaccf85c2e31cf044d94458e2001d1b Mon Sep 17 00:00:00 2001 From: Nicolly Vieira Date: Fri, 28 Oct 2022 14:22:03 -0300 Subject: [PATCH 01/10] feat(greet): Funcao feita --- 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}`; } From c132bbdf8062ab9319b4bb4bef3615cc8bb5904b Mon Sep 17 00:00:00 2001 From: Nicolly Vieira Date: Fri, 28 Oct 2022 14:47:01 -0300 Subject: [PATCH 02/10] feat(trianfleArea): funcao feita --- 02-triangleArea/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/02-triangleArea/index.js b/02-triangleArea/index.js index 7628fcd..9d10754 100644 --- a/02-triangleArea/index.js +++ b/02-triangleArea/index.js @@ -1,3 +1,4 @@ export function triangleArea(base, height) { // your code here -} \ No newline at end of file + return (base * height) / 2; +} \ No newline at end of file From dfd7c0129ad65f8413eeef39fd136df60e356a4c Mon Sep 17 00:00:00 2001 From: Nicolly Vieira Date: Fri, 28 Oct 2022 14:50:33 -0300 Subject: [PATCH 03/10] feat(maxValue): funcao feita --- 03-maxValue/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/03-maxValue/index.js b/03-maxValue/index.js index e433b31..03b6564 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,4 +1,7 @@ export function maxValue(values) { // implementar logica aqui - + if(values.length === 0) { + return 0; + } + return Math.max(...values); } \ No newline at end of file From db5f4cafe6bdff41fdf94987f968f91d14c896ed Mon Sep 17 00:00:00 2001 From: Nicolly Vieira Date: Fri, 28 Oct 2022 14:54:08 -0300 Subject: [PATCH 04/10] feat(fibonacci): funcao feita --- 04-fibonacci/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 37c64cc..d45f82c 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,4 @@ export function fibonacci(value) { // implementar logica aqui - + return value <= 1 ? value : fibonacci(value - 1) + fibonacci(value - 2); } \ No newline at end of file From d355e811b4845a530883318a2d254a71882d0bcc Mon Sep 17 00:00:00 2001 From: Nicolly Vieira Date: Fri, 28 Oct 2022 14:57:35 -0300 Subject: [PATCH 05/10] feat(isPrime): funcao feita --- 05-isPrime/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/05-isPrime/index.js b/05-isPrime/index.js index ec9c4ac..9f717e6 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,11 @@ export function isPrime(value) { // implementar logica aqui - + let quantidadeDeDivisores = 0 + for (let i = 1; i <= value; i++) { + if (value % i == 0) { + quantidadeDeDivisores++ + } + } + + return quantidadeDeDivisores == 2 ? true : false; } \ No newline at end of file From 7b1733a188a2a20711edc33a61f3ac6b85aee2c4 Mon Sep 17 00:00:00 2001 From: Nicolly Vieira Date: Fri, 28 Oct 2022 15:00:19 -0300 Subject: [PATCH 06/10] feat(sum): funcao feita --- 06-sum/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/06-sum/index.js b/06-sum/index.js index ebc2ee1..67d8c82 100644 --- a/06-sum/index.js +++ b/06-sum/index.js @@ -1,4 +1,6 @@ export function sum(values) { // implementar logica aqui - + return values.reduce((somatorio, valor) => { + return somatorio + valor + }, 0) } \ No newline at end of file From 0618ad9863aac32ee29fc3820aa39209713d87c1 Mon Sep 17 00:00:00 2001 From: Nicolly Vieira Date: Fri, 28 Oct 2022 15:04:27 -0300 Subject: [PATCH 07/10] feat(sumEven): funcao feita --- 07-sumEven/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/07-sumEven/index.js b/07-sumEven/index.js index bb1e095..7bd8ff9 100644 --- a/07-sumEven/index.js +++ b/07-sumEven/index.js @@ -1,4 +1,8 @@ export function sumEven(value) { // implementar logica aqui - + const numerosPares = value.filter(valor => (valor % 2) == 0) + + return numerosPares.reduce((somatorio, par) => { + return somatorio + par + }, 0) } \ No newline at end of file From 9861989bed8cd19fa21c84dfc3e4113174b543a8 Mon Sep 17 00:00:00 2001 From: Nicolly Vieira Date: Fri, 28 Oct 2022 15:07:47 -0300 Subject: [PATCH 08/10] feat(isAnagram): funcao feita --- 08-isAnagram/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/08-isAnagram/index.js b/08-isAnagram/index.js index 918308a..4e473ec 100644 --- a/08-isAnagram/index.js +++ b/08-isAnagram/index.js @@ -1,4 +1,7 @@ export function isAnagram(word1, word2) { // implementar logica aqui - + let primeiraString = word1.toLowerCase().split('').sort().join(''); + let segundaString = word2.toLowerCase().split('').sort().join(''); + + return primeiraString === segundaString ? true : false; } \ No newline at end of file From 7144ca7ade04f4698ce47ee0591a5762cc40056f Mon Sep 17 00:00:00 2001 From: Nicolly Vieira Date: Fri, 28 Oct 2022 15:11:42 -0300 Subject: [PATCH 09/10] feat(mosrUsedChar): funcao feita --- 09-mostRepeatedChar/index.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/09-mostRepeatedChar/index.js b/09-mostRepeatedChar/index.js index b113ed8..fddff13 100644 --- a/09-mostRepeatedChar/index.js +++ b/09-mostRepeatedChar/index.js @@ -1,4 +1,19 @@ export function mostUsedChar(text) { // implementar logica aqui - return "" + let textLower = text.toLowerCase().split(''); + let caractereMaisRepetido; + let numeroDeCaractereRepetido = 0; + + textLower.forEach(element => { + let caracteresRepetidos = textLower.filter((x) => x === element); + + if (caracteresRepetidos.length > numeroDeCaractereRepetido) { + caractereMaisRepetido = caracteresRepetidos.filter((caractere, indice) => { + return caracteresRepetidos.indexOf(caractere) === indice + }) + numeroDeCaractereRepetido = caracteresRepetidos.length + } + }); + + return caractereMaisRepetido.toString() } \ No newline at end of file From 447575f0bec9dbd48396ecfad9ab5a6731873fb1 Mon Sep 17 00:00:00 2001 From: Nicolly Vieira Date: Fri, 28 Oct 2022 15:14:45 -0300 Subject: [PATCH 10/10] feat(longestWords): funcao feita --- 10-longestWords/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/10-longestWords/index.js b/10-longestWords/index.js index a98d2d8..96543b6 100644 --- a/10-longestWords/index.js +++ b/10-longestWords/index.js @@ -1,4 +1,12 @@ export function longestWords(words) { // implementar logica aqui - + let numeroDeCaractere = 0 + + words.forEach((word) => { + if (word.length >= numeroDeCaractere) { + numeroDeCaractere = word.length + } + }) + + return words.filter((palavra) => (palavra.length == numeroDeCaractere)) } \ No newline at end of file