From 9bae1f72fcc673bcb30a3ab0f194c0c5200e13c1 Mon Sep 17 00:00:00 2001 From: ManuelaLuanaSchumackerTavares Date: Fri, 28 Oct 2022 14:33:02 -0300 Subject: [PATCH 01/11] feat(desafio): Adiciona primeira tarefa concluida --- 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 28ce5269bb2f0bf5491d7adf15fa85443cb5847f Mon Sep 17 00:00:00 2001 From: ManuelaLuanaSchumackerTavares Date: Fri, 28 Oct 2022 14:37:17 -0300 Subject: [PATCH 02/11] feat(desafio): Adiciona segunda tarefa concluida --- 02-triangleArea/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/02-triangleArea/index.js b/02-triangleArea/index.js index 7628fcd..85ffa32 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 From 89dda96dfd09364058f9aaf5812ade10b1843dac Mon Sep 17 00:00:00 2001 From: ManuelaLuanaSchumackerTavares Date: Fri, 28 Oct 2022 14:53:24 -0300 Subject: [PATCH 03/11] feat(desafio): Adiciona terceira tarefa concluida --- 03-maxValue/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/03-maxValue/index.js b/03-maxValue/index.js index e433b31..e296f5e 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,4 +1,10 @@ export function maxValue(values) { // implementar logica aqui - + if(values.length == 1){ + return values[i]; + }else if(values.length == []){ + return 0; + }else{ + return Math.max.apply(null, values); + } } \ No newline at end of file From f1125c7604f9661918c3e97f770270f976b132b3 Mon Sep 17 00:00:00 2001 From: ManuelaLuanaSchumackerTavares Date: Fri, 28 Oct 2022 15:02:21 -0300 Subject: [PATCH 04/11] feat(desafio): Adiciona quarta tarefa concluida --- 04-fibonacci/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 37c64cc..984c5e6 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,9 @@ export function fibonacci(value) { // implementar logica aqui - + if(value < 2){ + value = value; + }else{ + value = fibonacci(value - 1) + fibonacci(value - 2); + } + return value; } \ No newline at end of file From 7e5a62c8b2a35e0f240fdfb56469090e012087f8 Mon Sep 17 00:00:00 2001 From: ManuelaLuanaSchumackerTavares Date: Fri, 28 Oct 2022 15:12:34 -0300 Subject: [PATCH 05/11] feat(desafio): Adiciona quinta tarefa concluida --- 05-isPrime/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/05-isPrime/index.js b/05-isPrime/index.js index ec9c4ac..a6d3584 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,7 @@ export function isPrime(value) { // implementar logica aqui - + for(let i = 2; i < value; i++) + if((value % i === 0)) + value = false; + return value > 1; } \ No newline at end of file From 955c3872fafb5718886539658eb7e5e9303fd7e8 Mon Sep 17 00:00:00 2001 From: ManuelaLuanaSchumackerTavares Date: Fri, 28 Oct 2022 16:09:30 -0300 Subject: [PATCH 06/11] feat(desafio): Adiciona sexta tarefa concluida --- 06-sum/index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/06-sum/index.js b/06-sum/index.js index ebc2ee1..e093771 100644 --- a/06-sum/index.js +++ b/06-sum/index.js @@ -1,4 +1,17 @@ export function sum(values) { // implementar logica aqui - + let soma = 0; + if(values.length == 1){ + for(let i = 0; i < values.length; i++){ + soma = values[i]; + } + return soma; + }else if(values.length == []){ + return soma = 0; + }else{ + for(let i = 0; i < values.length; i++){ + soma += values[i]; + } + return soma; + } } \ No newline at end of file From 663341a99a1b69b8e7a54fb4f7eea56941a18923 Mon Sep 17 00:00:00 2001 From: ManuelaLuanaSchumackerTavares Date: Fri, 28 Oct 2022 16:19:22 -0300 Subject: [PATCH 07/11] feat(desafio): Adiciona setima tarefa concluida --- 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..e925b45 100644 --- a/07-sumEven/index.js +++ b/07-sumEven/index.js @@ -1,4 +1,10 @@ export function sumEven(value) { // implementar logica aqui - + let somaPar = 0; + for(let i = 0; i < value.length; i++){ + if(value[i] % 2 == 0){ + somaPar += value[i]; + } + } + return somaPar; } \ No newline at end of file From a9b425e2139b03189b09b5c92736075656c127f5 Mon Sep 17 00:00:00 2001 From: ManuelaLuanaSchumackerTavares Date: Fri, 28 Oct 2022 16:26:00 -0300 Subject: [PATCH 08/11] feat(desafio): Adiciona oitava tarefa concluida --- 08-isAnagram/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/08-isAnagram/index.js b/08-isAnagram/index.js index 918308a..4bf1e35 100644 --- a/08-isAnagram/index.js +++ b/08-isAnagram/index.js @@ -1,4 +1,11 @@ export function isAnagram(word1, word2) { // implementar logica aqui - + const palavra = str => + str + .toLowerCase() + .replace(/[^a-z0-9]/, '') + .split('') + .sort() + .join(''); +return palavra(word1) === palavra(word2); } \ No newline at end of file From a334ca8a2638bf98ad6a79894501732234e44145 Mon Sep 17 00:00:00 2001 From: ManuelaLuanaSchumackerTavares Date: Fri, 28 Oct 2022 16:32:30 -0300 Subject: [PATCH 09/11] feat(desafio): Adiciona nona tarefa concluida --- 09-mostRepeatedChar/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/09-mostRepeatedChar/index.js b/09-mostRepeatedChar/index.js index b113ed8..3e46085 100644 --- a/09-mostRepeatedChar/index.js +++ b/09-mostRepeatedChar/index.js @@ -1,4 +1,12 @@ export function mostUsedChar(text) { // implementar logica aqui - return "" + let letraRepetida; + let str = text.toLowerCase().replace(/\,*\s/g, "").split("", text.length); + for(let i = 0; i < text.length; i++){ + for(let maisRepetida = i + 1; maisRepetida < text.length; maisRepetida++){ + letraRepetida = str[i]; + } + } + + return letraRepetida; } \ No newline at end of file From d1c5f75dd1e405ad1fe51beb22a24423e039a194 Mon Sep 17 00:00:00 2001 From: ManuelaLuanaSchumackerTavares Date: Mon, 31 Oct 2022 12:27:13 -0300 Subject: [PATCH 10/11] feat(desafio): Adiciona decima tarefa concluida --- 10-longestWords/index.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/10-longestWords/index.js b/10-longestWords/index.js index a98d2d8..827d3e7 100644 --- a/10-longestWords/index.js +++ b/10-longestWords/index.js @@ -1,4 +1,30 @@ export function longestWords(words) { // implementar logica aqui - + + if(words.length == 0 || words.length == 1) { + return words; + }else{ + words.sort((a, b) => { + if(a.length > b.length){ + return -1; + }else if(a.length < b.length){ + return 1; + }else{ + return 0; + } + }); + + let wordTaker = []; + let firstWord = words[0].length; + + for (let i = 0; i < words.length; i++) { + const element = words[i]; + if(element.length == firstWord){ + wordTaker.push(element); + }else{ + break; + } + } + return wordTaker; + } } \ No newline at end of file From 74da8d46ae74e340387b8141867a0e1ace89f782 Mon Sep 17 00:00:00 2001 From: ManuelaLuanaSchumackerTavares Date: Mon, 31 Oct 2022 14:19:47 -0300 Subject: [PATCH 11/11] refactor(desafio): Otimizacao da sequencia de fibonnaci --- 04-fibonacci/index.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 984c5e6..ad1783a 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,9 +1,19 @@ export function fibonacci(value) { // implementar logica aqui - if(value < 2){ - value = value; - }else{ - value = fibonacci(value - 1) + fibonacci(value - 2); + if(value == 0){ + return value; } - return value; + let firstValue = 0, secondValue = 1, thirdValue =1; + for(let i = 2; i <= value; i++){ + thirdValue = firstValue + secondValue; + firstValue = secondValue; + secondValue = thirdValue; + } + return thirdValue; + // if(value < 2){ + // value = value; + // }else{ + // value = fibonacci(value - 1) + fibonacci(value - 2); + // } + // return value; } \ No newline at end of file