From e8b4c77a7ec6836ab504b3aea143e8a2550264e6 Mon Sep 17 00:00:00 2001 From: Gustavo_Rallenson Date: Fri, 28 Oct 2022 17:10:07 -0300 Subject: [PATCH 01/10] Feat:Adicionando Greet --- 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 3fabe8762db348abe3e0abf64855272cfe116e84 Mon Sep 17 00:00:00 2001 From: Gustavo_Rallenson Date: Fri, 28 Oct 2022 17:21:09 -0300 Subject: [PATCH 02/10] Feat:Finalizado triangleArea --- 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..505adc2 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 -- 2.34.1 From 38030a8427728b871d8626e50c1d4cd2c034843c Mon Sep 17 00:00:00 2001 From: Gustavo_Rallenson Date: Fri, 28 Oct 2022 19:36:26 -0300 Subject: [PATCH 03/10] Feat:Finalizando maxValue --- 03-maxValue/index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/03-maxValue/index.js b/03-maxValue/index.js index e433b31..6a57400 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,4 +1,16 @@ export function maxValue(values) { // implementar logica aqui - + const Arr = values + let Maior = values[0] + if(Maior === undefined){ + return Maior = 0; + } + else{ + Arr.forEach((atual)=>{ + if(Maior < atual){ + Maior = atual + } + }) + } + return Maior; } \ No newline at end of file -- 2.34.1 From 04bfee006721448fb68928ebf5325e0e5ddaae5d Mon Sep 17 00:00:00 2001 From: Gustavo_Rallenson Date: Fri, 28 Oct 2022 19:55:07 -0300 Subject: [PATCH 04/10] Feat:Finalizado Fibonacci --- 04-fibonacci/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 37c64cc..51e44d5 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,7 @@ export function fibonacci(value) { // implementar logica aqui - + if (value <= 1) { + return value; +} +return fibonacci(value -1 ) + fibonacci(value -2) } \ No newline at end of file -- 2.34.1 From fce8544071905e07cbbc1e99d91733fd022dab88 Mon Sep 17 00:00:00 2001 From: Gustavo_Rallenson Date: Fri, 28 Oct 2022 20:19:33 -0300 Subject: [PATCH 05/10] Feat:Finalizado isPrime --- 05-isPrime/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/05-isPrime/index.js b/05-isPrime/index.js index ec9c4ac..ad1c382 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,13 @@ export function isPrime(value) { // implementar logica aqui - + if(value === 1){ + return false + }else{ + for(let divisor = 2; divisor < value; divisor++){ + if((value%divisor === 0)){ + return false + } + } + } + return true } \ No newline at end of file -- 2.34.1 From acb49b92be9e1dc6795064c7cfbf7ee108deaf58 Mon Sep 17 00:00:00 2001 From: Gustavo_Rallenson Date: Fri, 28 Oct 2022 20:57:39 -0300 Subject: [PATCH 06/10] Feat: Finalizado sum --- 06-sum/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/06-sum/index.js b/06-sum/index.js index ebc2ee1..a1f206c 100644 --- a/06-sum/index.js +++ b/06-sum/index.js @@ -1,4 +1,8 @@ export function sum(values) { // implementar logica aqui - + let atual = 0 + for(let i = 0;i < values.length;i++){ + atual = atual + values[i] + } + return atual } \ No newline at end of file -- 2.34.1 From bc26939af95b3794164adf9885f2bc5cd3c3c1c9 Mon Sep 17 00:00:00 2001 From: Gustavo_Rallenson Date: Fri, 28 Oct 2022 21:28:26 -0300 Subject: [PATCH 07/10] Feat:Finalaizando SumEven --- 07-sumEven/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/07-sumEven/index.js b/07-sumEven/index.js index bb1e095..a92be14 100644 --- a/07-sumEven/index.js +++ b/07-sumEven/index.js @@ -1,4 +1,14 @@ export function sumEven(value) { // implementar logica aqui - + let Soma = 0 + for(let i = 0;i < value.length;i++){ + if(value === undefined){ + return 0 + }else{ + if(value[i] % 2 === 0){ + Soma = value[i] + Soma + } + } + } + return Soma } \ No newline at end of file -- 2.34.1 From d98388c5d26cab80f65b1b2d02839433f6bae6a1 Mon Sep 17 00:00:00 2001 From: Gustavo_Rallenson Date: Fri, 28 Oct 2022 21:44:37 -0300 Subject: [PATCH 08/10] Feat:Finalizado isAnagram --- 08-isAnagram/index.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/08-isAnagram/index.js b/08-isAnagram/index.js index 918308a..7acb5f9 100644 --- a/08-isAnagram/index.js +++ b/08-isAnagram/index.js @@ -1,4 +1,20 @@ export function isAnagram(word1, word2) { // implementar logica aqui - + const anagrama = word1.toLowerCase().split(''); + const palavra = word2.toLowerCase().split(''); + palavra.sort((a, b) => { + return a.localeCompare(b); + }) + anagrama.sort((a, b) => { + return a.localeCompare(b); + }) + if( anagrama.length > palavra.length){ + return false + } + for(let i = 0;i < word2.length; i++){ + if(anagrama[i] !== palavra[i]){ + return false; + } + } +return true; } \ No newline at end of file -- 2.34.1 From 3b5099d7d16bd4e5fa277c03dd1e4cedc1869c6b Mon Sep 17 00:00:00 2001 From: Gustavo_Rallenson Date: Fri, 28 Oct 2022 21:53:51 -0300 Subject: [PATCH 09/10] Feat:Finalizado:MostRepeatedChar --- 09-mostRepeatedChar/index.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/09-mostRepeatedChar/index.js b/09-mostRepeatedChar/index.js index b113ed8..230e645 100644 --- a/09-mostRepeatedChar/index.js +++ b/09-mostRepeatedChar/index.js @@ -1,4 +1,25 @@ export function mostUsedChar(text) { // implementar logica aqui - return "" + const CharUnited = text.toLowerCase().split(" ").join('') + const Char = CharUnited.split(""); + Char.sort((a, b) => { + return a.localeCompare(b); + }) + let Count = 1 + let maior = 0 + let FrequenteChar = '' + for(let i = 1;i < text.length; i ++ ){ + //console.log(maior, FrequenteChar) + if(Char[i] === Char[i-1]){ + Count ++ + }else{ + Count = 1 + } + if (Count > maior){ + maior = Count + FrequenteChar = Char[i] + } + } + + return FrequenteChar } \ No newline at end of file -- 2.34.1 From dc565a3d8cba30cf2d3c13a0c61ee93e5a7c0708 Mon Sep 17 00:00:00 2001 From: Gustavo_Rallenson Date: Fri, 28 Oct 2022 23:16:50 -0300 Subject: [PATCH 10/10] Feat:Finalizado longestwords --- 10-longestWords/index.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/10-longestWords/index.js b/10-longestWords/index.js index a98d2d8..6407877 100644 --- a/10-longestWords/index.js +++ b/10-longestWords/index.js @@ -1,4 +1,14 @@ export function longestWords(words) { // implementar logica aqui - -} \ No newline at end of file + const Listapalavras = words + let Maior = [' '] + Listapalavras.map((palavra) => { + if(palavra.length === Maior[0].length){ + Maior.push(palavra) + } + else if(palavra.length > Maior[0].length){ + Maior = [palavra] + } + }) + return Maior +} -- 2.34.1