From eda78d854b436b8882ec4a85b6155fa0664b2125 Mon Sep 17 00:00:00 2001 From: Matheus Date: Wed, 2 Nov 2022 11:36:09 -0300 Subject: [PATCH 01/10] =?UTF-8?q?feat:=20cria=C3=A7=C3=A3o=20da=20resposta?= =?UTF-8?q?=20do=2001-greeting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 01-greeting/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/01-greeting/index.js b/01-greeting/index.js index 8f551af..6b88803 100644 --- a/01-greeting/index.js +++ b/01-greeting/index.js @@ -1,4 +1,5 @@ export function greet(name) { // implementar logica aqui - return ""; + let resultadoNome = `Hello ${name}`; + return resultadoNome; } From 924f2839fe2370fd8b87b742fd77fe2d23816fb9 Mon Sep 17 00:00:00 2001 From: Matheus Date: Wed, 2 Nov 2022 11:40:44 -0300 Subject: [PATCH 02/10] =?UTF-8?q?feat:=20cria=C3=A7=C3=A3o=20da=20resposta?= =?UTF-8?q?=20do=2002-triangleArea?= 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..ace24c8 100644 --- a/02-triangleArea/index.js +++ b/02-triangleArea/index.js @@ -1,3 +1,5 @@ export function triangleArea(base, height) { // your code here + let soma = base * height / 2 + return soma } \ No newline at end of file From aab21161ae964e1f26745f1a8a38dfc3d4f7bb59 Mon Sep 17 00:00:00 2001 From: Matheus Date: Wed, 2 Nov 2022 11:43:27 -0300 Subject: [PATCH 03/10] =?UTF-8?q?feat:=20cria=C3=A7=C3=A3o=20da=20resposta?= =?UTF-8?q?=20do=2003-maxValue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 03-maxValue/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/03-maxValue/index.js b/03-maxValue/index.js index e433b31..8b8073a 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,4 +1,8 @@ export function maxValue(values) { // implementar logica aqui - + let maiorNumero = Math.max(...values); + if (values.length === 0) { + return maiorNumero=0 + } else {}; + return maiorNumero ; } \ No newline at end of file From 8947b7635126ceb44fdb9b386a611f27d5c343aa Mon Sep 17 00:00:00 2001 From: Matheus Date: Wed, 2 Nov 2022 11:46:38 -0300 Subject: [PATCH 04/10] =?UTF-8?q?feat:=20cria=C3=A7=C3=A3o=20da=20resposat?= =?UTF-8?q?=20do=2004-fibonacci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 04-fibonacci/index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 37c64cc..976c078 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,17 @@ export function fibonacci(value) { // implementar logica aqui - + let number1 = 0; + let number2 = 1; + let result; + + if (value === 0 || value === 1 ) { + return value; + } else { + for (let i = 1 ; i < value ; i++) { + result = number2 + number1; + number1 = number2; + number2 = result; + } + } + return result; } \ No newline at end of file From 4f1db060f4cdd574493e2533ba9df165b78b4700 Mon Sep 17 00:00:00 2001 From: Matheus Date: Wed, 2 Nov 2022 11:52:22 -0300 Subject: [PATCH 05/10] =?UTF-8?q?feat:=20cria=C3=A7=C3=A3o=20da=20respopst?= =?UTF-8?q?a=20do=2005-isPrime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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..18936a8 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,9 @@ export function isPrime(value) { // implementar logica aqui - + for (let index = 2; index < value; index++) { + if (value % index === 0) { + return false + } + } + return value > 1; } \ No newline at end of file From c2815674bcd8323056549cd1436f63a83001ff0a Mon Sep 17 00:00:00 2001 From: Matheus Date: Wed, 2 Nov 2022 12:30:35 -0300 Subject: [PATCH 06/10] =?UTF-8?q?feat:=20cria=C3=A7=C3=A3o=20da=20resposta?= =?UTF-8?q?=20do=2006-sum?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 06-sum/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/06-sum/index.js b/06-sum/index.js index ebc2ee1..ca39303 100644 --- a/06-sum/index.js +++ b/06-sum/index.js @@ -1,4 +1,9 @@ export function sum(values) { // implementar logica aqui - + let soma = 0; + + for (let index = 0; index < values.length; index++) { + soma += values[index]; + } + return soma; } \ No newline at end of file From de6cd9832de859df6707e3bd32cc061d33ece7d5 Mon Sep 17 00:00:00 2001 From: Matheus Date: Wed, 2 Nov 2022 12:39:28 -0300 Subject: [PATCH 07/10] =?UTF-8?q?feat:=20cria=C3=A7=C3=A3o=20da=20resposta?= =?UTF-8?q?=20do=2007-sumEven?= 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..6e14f98 100644 --- a/07-sumEven/index.js +++ b/07-sumEven/index.js @@ -1,4 +1,10 @@ export function sumEven(value) { // implementar logica aqui - + var total = 0; + for (let i of value) { + if (i % 2 ===0) { + total += i; + } + } + return total; } \ No newline at end of file From 39515dd0474ab5dd20e60e79adad467fb107abb9 Mon Sep 17 00:00:00 2001 From: Matheus Date: Wed, 2 Nov 2022 12:42:08 -0300 Subject: [PATCH 08/10] =?UTF-8?q?feat:=20cria=C3=A7=C3=A3o=20da=20resposat?= =?UTF-8?q?=20do=2008-isAnagram?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 08-isAnagram/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/08-isAnagram/index.js b/08-isAnagram/index.js index 918308a..e06ff3c 100644 --- a/08-isAnagram/index.js +++ b/08-isAnagram/index.js @@ -1,4 +1,14 @@ export function isAnagram(word1, word2) { // implementar logica aqui - + if(word1 === word2) { + return true; + } else if (word1.length !== word2.length) { + return false; + } else { + var str1 = word1.toLowerCase().split("").sort().join(""); + var str2 = word2.toLowerCase().split("").sort().join(""); + var result = (str1 == str2); + return result; + } + } \ No newline at end of file From 614bead0f71fee16b49218ab901f3605eb5e02d5 Mon Sep 17 00:00:00 2001 From: Matheus Date: Wed, 2 Nov 2022 13:24:45 -0300 Subject: [PATCH 09/10] =?UTF-8?q?feat:=20cria=C3=A7=C3=A3o=20da=20resposta?= =?UTF-8?q?=20do=2009-mostRepeatedChar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 09-mostRepeatedChar/index.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/09-mostRepeatedChar/index.js b/09-mostRepeatedChar/index.js index b113ed8..52eb7de 100644 --- a/09-mostRepeatedChar/index.js +++ b/09-mostRepeatedChar/index.js @@ -1,4 +1,22 @@ export function mostUsedChar(text) { // implementar logica aqui - return "" + const boxChar = {}; + let max = 0; + let result = ''; + + for(let char of text){ + if(boxChar[char]){ + boxChar[char]++; + }else{ + boxChar[char] = 1; + } + } + for(let char in boxChar){ + if(boxChar[char] > max){ + max = boxChar[char]; + result = char; + } + } + + return result; } \ No newline at end of file From 9b60bfe0286a4035acd4317e6a3fa4c70da1a28f Mon Sep 17 00:00:00 2001 From: Matheus Date: Wed, 2 Nov 2022 13:32:48 -0300 Subject: [PATCH 10/10] =?UTF-8?q?feat:=20cria=C3=A7=C3=A3o=20da=20resposta?= =?UTF-8?q?=20=20do=2010-longestWords?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 10-longestWords/index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/10-longestWords/index.js b/10-longestWords/index.js index a98d2d8..58b8a0f 100644 --- a/10-longestWords/index.js +++ b/10-longestWords/index.js @@ -1,4 +1,17 @@ export function longestWords(words) { // implementar logica aqui - + + let loop = 0; + let newWords = []; + for (let index = 0; index < words.length; index++) { + if (words[index].length > loop) { + loop = words[index].length + } + } + for (let index = 0; index < words.length; index++) { + if (loop === words[index].length) { + newWords.push(words[index]) + } + } + return newWords; } \ No newline at end of file