From b40d4b432f0e05b035cd9751635c793769a05737 Mon Sep 17 00:00:00 2001 From: devartes Date: Fri, 28 Oct 2022 07:38:49 -0300 Subject: [PATCH 01/11] =?UTF-8?q?feat:=20adicionando=20solu=C3=A7=C3=A3o?= =?UTF-8?q?=20do=201=C2=B0=20desafio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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 ae920dca296d76e53cdf90d3ba103f1412230ea1 Mon Sep 17 00:00:00 2001 From: devartes Date: Fri, 28 Oct 2022 07:54:38 -0300 Subject: [PATCH 02/11] =?UTF-8?q?feat:=20adicionando=20solu=C3=A7=C3=A3o?= =?UTF-8?q?=20do=202=C2=B0=20desafio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 02-triangleArea/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/02-triangleArea/index.js b/02-triangleArea/index.js index 7628fcd..5346213 100644 --- a/02-triangleArea/index.js +++ b/02-triangleArea/index.js @@ -1,3 +1,5 @@ export function triangleArea(base, height) { // your code here + let area = (base * height)/2; + return area; } \ No newline at end of file From d8ba6787abca238bd8bf0ab5ed084ace15709616 Mon Sep 17 00:00:00 2001 From: devartes Date: Fri, 28 Oct 2022 08:06:45 -0300 Subject: [PATCH 03/11] =?UTF-8?q?feat:=20adicionando=20solu=C3=A7=C3=A3o?= =?UTF-8?q?=20do=203=C2=B0=20desafio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 03-maxValue/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/03-maxValue/index.js b/03-maxValue/index.js index e433b31..15e7cd1 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,4 +1,12 @@ export function maxValue(values) { // implementar logica aqui - + if (values.length) { + let max = -Infinity; + + for (let num of values) { + max = num > max ? num : max; + } + return max; + } + return 0; } \ No newline at end of file From b623b716a9dd5d085bb229175ad3bf586c47aad7 Mon Sep 17 00:00:00 2001 From: devartes Date: Fri, 28 Oct 2022 08:18:37 -0300 Subject: [PATCH 04/11] =?UTF-8?q?feat:=20adicionando=20solu=C3=A7=C3=A3o?= =?UTF-8?q?=20do=204=C2=B0=20desafio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 04-fibonacci/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 37c64cc..bbdc320 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,5 @@ export function fibonacci(value) { // implementar logica aqui - + var sqrt5 = Math.sqrt(5); + return Math.round(Math.pow(((1 + sqrt5) / 2), value) / sqrt5); } \ No newline at end of file From acdd7bd2cc468b67a3967b71d5fc1d541c07a389 Mon Sep 17 00:00:00 2001 From: devartes Date: Fri, 28 Oct 2022 08:30:33 -0300 Subject: [PATCH 05/11] =?UTF-8?q?feat:=20adicionando=20solu=C3=A7=C3=A3o?= =?UTF-8?q?=20do=205=C2=B0=20desafio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 05-isPrime/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/05-isPrime/index.js b/05-isPrime/index.js index ec9c4ac..db0459d 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,8 @@ 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 From 6d91bf9bcb52950de44eb197d877c318493e969e Mon Sep 17 00:00:00 2001 From: devartes Date: Fri, 28 Oct 2022 08:35:16 -0300 Subject: [PATCH 06/11] =?UTF-8?q?feat:=20adicionando=20solu=C3=A7=C3=A3o?= =?UTF-8?q?=20do=206=C2=B0=20desafio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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..b927d12 100644 --- a/06-sum/index.js +++ b/06-sum/index.js @@ -1,4 +1,8 @@ export function sum(values) { // implementar logica aqui - + let sumOfArrays = 0; + for(let index = 0; index < values.length; index +=1) { + sumOfArrays = sumOfArrays + values[index]; + } + return sumOfArrays; } \ No newline at end of file From e7ebd59708610c4c573faf862d011eb41250d114 Mon Sep 17 00:00:00 2001 From: devartes Date: Fri, 28 Oct 2022 08:41:18 -0300 Subject: [PATCH 07/11] =?UTF-8?q?feat:=20adicionando=20solu=C3=A7=C3=A3o?= =?UTF-8?q?=20do=207=C2=B0=20desafio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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..804eb90 100644 --- a/07-sumEven/index.js +++ b/07-sumEven/index.js @@ -1,4 +1,10 @@ export function sumEven(value) { // implementar logica aqui - + let sumOfEven = 0; + for (let i = 0; i < value.length; i++) { + if (value[i] % 2 === 0) { + sumOfEven = sumOfEven + value[i]; + } + } + return sumOfEven; } \ No newline at end of file From e78fc6780fdd98d72805599e165e4468cfd72bf1 Mon Sep 17 00:00:00 2001 From: devartes Date: Fri, 28 Oct 2022 08:46:58 -0300 Subject: [PATCH 08/11] =?UTF-8?q?feat:=20adicionando=20solu=C3=A7=C3=A3o?= =?UTF-8?q?=20do=208=C2=B0=20desafio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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..7600588 100644 --- a/08-isAnagram/index.js +++ b/08-isAnagram/index.js @@ -1,4 +1,11 @@ export function isAnagram(word1, word2) { // implementar logica aqui - + const Anagram = str => + str + .toLowerCase() + .replace(/[^a-z0-9]/gi, '') + .split('') + .sort() + .join(''); + return Anagram(word1) === Anagram(word2); } \ No newline at end of file From ef2c7d7aef491bdf04e54b3eb555b7a7187df062 Mon Sep 17 00:00:00 2001 From: devartes Date: Fri, 28 Oct 2022 08:51:23 -0300 Subject: [PATCH 09/11] =?UTF-8?q?feat:=20adicionando=20solu=C3=A7=C3=A3o?= =?UTF-8?q?=20do=209=C2=B0=20desafio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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..5c17bdb 100644 --- a/09-mostRepeatedChar/index.js +++ b/09-mostRepeatedChar/index.js @@ -1,4 +1,12 @@ export function mostUsedChar(text) { // implementar logica aqui - return "" + let max = 0, + maxChar = ''; + text.split('').forEach(function(char){ + if(text.split(char).length > max) { + max = text.split(char).length; + maxChar = char; + } + }); + return maxChar; } \ No newline at end of file From f1231ee3bd7fcfee6c4b45ee06dcbc018b32ce2f Mon Sep 17 00:00:00 2001 From: devartes Date: Fri, 28 Oct 2022 08:57:42 -0300 Subject: [PATCH 10/11] =?UTF-8?q?feat:=20adicionando=20solu=C3=A7=C3=A3o?= =?UTF-8?q?=20do10=C2=B0=20desafio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 10-longestWords/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/10-longestWords/index.js b/10-longestWords/index.js index a98d2d8..784e7b0 100644 --- a/10-longestWords/index.js +++ b/10-longestWords/index.js @@ -1,4 +1,5 @@ export function longestWords(words) { // implementar logica aqui - + let maxWord = Math.max(...words.map( elem => elem.length)) + return words.filter(elem => elem.length === maxWord) } \ No newline at end of file From c9a298d9cd487174e9d3f2682103d2ce22d39617 Mon Sep 17 00:00:00 2001 From: devartes Date: Fri, 28 Oct 2022 08:57:42 -0300 Subject: [PATCH 11/11] =?UTF-8?q?feat:=20adicionando=20solu=C3=A7=C3=A3o?= =?UTF-8?q?=20do=2010=C2=B0=20desafio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 10-longestWords/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/10-longestWords/index.js b/10-longestWords/index.js index a98d2d8..784e7b0 100644 --- a/10-longestWords/index.js +++ b/10-longestWords/index.js @@ -1,4 +1,5 @@ export function longestWords(words) { // implementar logica aqui - + let maxWord = Math.max(...words.map( elem => elem.length)) + return words.filter(elem => elem.length === maxWord) } \ No newline at end of file