From 9f0206057ad1624cf7b309d33efa9375e90cc2c4 Mon Sep 17 00:00:00 2001 From: vitorsoaresdev Date: Fri, 28 Oct 2022 11:38:54 -0300 Subject: [PATCH 01/10] feat: finalizado greeting --- 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..544b5f1 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 9cc120fabb45e168d2906145534f29b0ff2e1082 Mon Sep 17 00:00:00 2001 From: vitorsoaresdev Date: Fri, 28 Oct 2022 11:42:49 -0300 Subject: [PATCH 02/10] feat: finalizado triangleArea --- 02-triangleArea/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/02-triangleArea/index.js b/02-triangleArea/index.js index 7628fcd..bc6458b 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 01ac558b062cb1fa9b9abee3611bfb06a2807776 Mon Sep 17 00:00:00 2001 From: vitorsoaresdev Date: Fri, 28 Oct 2022 11:45:34 -0300 Subject: [PATCH 03/10] feat: finalizado maxValue --- 03-maxValue/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/03-maxValue/index.js b/03-maxValue/index.js index e433b31..87d8610 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,4 +1,9 @@ export function maxValue(values) { // implementar logica aqui - + if(values.length == 0) return 0; + + return values.reduce((ac, value) => { + if(ac > value) return ac; + return value + }, ); } \ No newline at end of file -- 2.34.1 From bfdc5780442612ebbbc4cb4778102654fbec73d7 Mon Sep 17 00:00:00 2001 From: vitorsoaresdev Date: Fri, 28 Oct 2022 11:49:25 -0300 Subject: [PATCH 04/10] feat: finalizado fibonacci --- 04-fibonacci/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 37c64cc..f764b91 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,15 @@ export function fibonacci(value) { // implementar logica aqui + let n1 = 0 + let n2 = 1 + let fibo + + for (let i = 1; i <= value; i++) { + fibo = n1 + n2; + n1 = n2; + n2 = fibo; + }; + + return n1 } \ No newline at end of file -- 2.34.1 From 58d5a12222e0b831705691d1c2451b99a6798623 Mon Sep 17 00:00:00 2001 From: vitorsoaresdev Date: Fri, 28 Oct 2022 11:51:46 -0300 Subject: [PATCH 05/10] feat: finalizado isPrime --- 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..d33bcde 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 -- 2.34.1 From 8134411c16fb59b0ff2cc5554a5074cdd1edfd2d Mon Sep 17 00:00:00 2001 From: vitorsoaresdev Date: Fri, 28 Oct 2022 11:55:46 -0300 Subject: [PATCH 06/10] feat: finalizado sum --- 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..c15ba29 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((ac, value) => { + return ac += value; + }, 0); } \ No newline at end of file -- 2.34.1 From 42f653c39458c3cef57bc9e1d8c2a52957dc509e Mon Sep 17 00:00:00 2001 From: vitorsoaresdev Date: Fri, 28 Oct 2022 12:00:57 -0300 Subject: [PATCH 07/10] feat: finalizado sumEven --- 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..9dd0195 100644 --- a/07-sumEven/index.js +++ b/07-sumEven/index.js @@ -1,4 +1,8 @@ export function sumEven(value) { // implementar logica aqui - + return value.filter((number) => { + if(number % 2 == 0) return number; + }).reduce((ac, number) => { + return ac += number; + }, 0); } \ No newline at end of file -- 2.34.1 From 302ca997f68b8bbee8dde5e3f00409fd622a8446 Mon Sep 17 00:00:00 2001 From: vitorsoaresdev Date: Fri, 28 Oct 2022 12:05:06 -0300 Subject: [PATCH 08/10] feat: finalizado isAnagram --- 08-isAnagram/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/08-isAnagram/index.js b/08-isAnagram/index.js index 918308a..a73057d 100644 --- a/08-isAnagram/index.js +++ b/08-isAnagram/index.js @@ -1,4 +1,8 @@ export function isAnagram(word1, word2) { // implementar logica aqui - + word1 = word1.toLowerCase().split('').sort().join(''); + word2 = word2.toLowerCase().split('').sort().join(''); + + if(word1 == word2) return true; + return false; } \ No newline at end of file -- 2.34.1 From b4852810c4e58124417fb67ba6334b574a20e9c6 Mon Sep 17 00:00:00 2001 From: vitorsoaresdev Date: Fri, 28 Oct 2022 12:33:01 -0300 Subject: [PATCH 09/10] feat: finalizado mostRepeatedChar --- 09-mostRepeatedChar/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/09-mostRepeatedChar/index.js b/09-mostRepeatedChar/index.js index b113ed8..6507055 100644 --- a/09-mostRepeatedChar/index.js +++ b/09-mostRepeatedChar/index.js @@ -1,4 +1,14 @@ export function mostUsedChar(text) { // implementar logica aqui - return "" + let max = 0 + let maxChar = '' + + text.split('').forEach((char) => { + if(text.split(char).length > max) { + max = text.split(char).length; + maxChar = char; + } + }); + + return maxChar } \ No newline at end of file -- 2.34.1 From d49e9fbdf8ac3901d54e94530909a8e374044224 Mon Sep 17 00:00:00 2001 From: vitorsoaresdev Date: Fri, 28 Oct 2022 17:12:14 -0300 Subject: [PATCH 10/10] feat: finalizado longestWords --- 10-longestWords/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/10-longestWords/index.js b/10-longestWords/index.js index a98d2d8..45ede10 100644 --- a/10-longestWords/index.js +++ b/10-longestWords/index.js @@ -1,4 +1,20 @@ export function longestWords(words) { // implementar logica aqui + let long = '' + + const longest = words.map((word) => { + if(word.length > long.length) { + long = word; + } + + return word + + }).filter((word) => { + if(word.length === long.length) { + return word; + } + }); + + return longest } \ No newline at end of file -- 2.34.1