From 3c0bfc1f1cbab956af86a2683e784437a9ba6191 Mon Sep 17 00:00:00 2001 From: danielmoliaribarbosa Date: Fri, 28 Oct 2022 14:43:15 -0300 Subject: [PATCH 01/10] =?UTF-8?q?feat(greeting):=20Implementa=20fun=C3=A7?= =?UTF-8?q?=C3=A3o=20greeting?= 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}`; } -- 2.34.1 From 5cf92a84c15933d2f0004d1105660070773acc5a Mon Sep 17 00:00:00 2001 From: danielmoliaribarbosa Date: Fri, 28 Oct 2022 14:47:18 -0300 Subject: [PATCH 02/10] =?UTF-8?q?feat(triangleArea):=20Implementa=20fun?= =?UTF-8?q?=C3=A7=C3=A3o=20triangleArea?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 02-triangleArea/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/02-triangleArea/index.js b/02-triangleArea/index.js index 7628fcd..c09415e 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 d377a0c420ead7fd6784da88aad00f205719bbf4 Mon Sep 17 00:00:00 2001 From: danielmoliaribarbosa Date: Fri, 28 Oct 2022 14:50:35 -0300 Subject: [PATCH 03/10] =?UTF-8?q?feat(maxValue):=20Implementa=20fun=C3=A7?= =?UTF-8?q?=C3=A3o=20maxValue?= 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..2136361 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,4 +1,8 @@ export function maxValue(values) { // implementar logica aqui - + let maxV = Math.max(...values); + if(!values.length){ + maxV = 0; + } + return maxV; } \ No newline at end of file -- 2.34.1 From cfe0e803bfd43e7845d5482b7ef557a6e608aff0 Mon Sep 17 00:00:00 2001 From: danielmoliaribarbosa Date: Fri, 28 Oct 2022 14:57:41 -0300 Subject: [PATCH 04/10] =?UTF-8?q?feat(fibonacci):=20Implementa=20fun=C3=A7?= =?UTF-8?q?=C3=A3o=20fibonacci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 04-fibonacci/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 37c64cc..fbd62d0 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,13 @@ export function fibonacci(value) { // implementar logica aqui - + let first = 0; + let second = 1; + if (value <= 1) { + return value; + } + for(let i = 3; i <= value; i++){ + second = first + second; + first = second - first; + } + return first + second; } \ No newline at end of file -- 2.34.1 From 264b1a16607f79c6ab632494245a53bf92d47b77 Mon Sep 17 00:00:00 2001 From: danielmoliaribarbosa Date: Fri, 28 Oct 2022 15:03:13 -0300 Subject: [PATCH 05/10] =?UTF-8?q?feat(isPrime):=20Implementa=20fun=C3=A7?= =?UTF-8?q?=C3=A3o=20isPrime?= 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..d3d70d2 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,9 @@ export function isPrime(value) { // implementar logica aqui - + for (let x = 2; x < value; x++) { + if (value % x === 0 || value <= 1) { + return false; + } + } + return true; } \ No newline at end of file -- 2.34.1 From 8b72b62665bffb508d22e1f5aa6c34d9d3d75421 Mon Sep 17 00:00:00 2001 From: danielmoliaribarbosa Date: Fri, 28 Oct 2022 15:05:20 -0300 Subject: [PATCH 06/10] =?UTF-8?q?feat(sum):=20Implementa=20fun=C3=A7=C3=A3?= =?UTF-8?q?o=20sum?= 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..911b188 100644 --- a/06-sum/index.js +++ b/06-sum/index.js @@ -1,4 +1,8 @@ export function sum(values) { // implementar logica aqui - + let soma = 0; + for (let i = 0; i < values.length; i++) { + soma += values[i]; + } + return soma; } \ No newline at end of file -- 2.34.1 From b2048f61d86a31f91263321508ed41dc7c3294f7 Mon Sep 17 00:00:00 2001 From: danielmoliaribarbosa Date: Fri, 28 Oct 2022 15:10:45 -0300 Subject: [PATCH 07/10] =?UTF-8?q?feat(sumEven):=20Implementa=20fun=C3=A7?= =?UTF-8?q?=C3=A3o=20sumEven?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 07-sumEven/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/07-sumEven/index.js b/07-sumEven/index.js index bb1e095..962ef5c 100644 --- a/07-sumEven/index.js +++ b/07-sumEven/index.js @@ -1,4 +1,10 @@ export function sumEven(value) { // implementar logica aqui - -} \ No newline at end of file + let soma = 0; + for (let i = 0; i < value.length; i++) { + if (value[i] % 2 == 0) { + soma += value[i]; + } + } + return soma; +} -- 2.34.1 From 2cf01bdc9fd8ae2c250af96d79069d72b254b3a4 Mon Sep 17 00:00:00 2001 From: danielmoliaribarbosa Date: Fri, 28 Oct 2022 15:12:57 -0300 Subject: [PATCH 08/10] =?UTF-8?q?feat(isAnagram):=20Implementa=20fun=C3=A7?= =?UTF-8?q?=C3=A3o=20isAnagram?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 08-isAnagram/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/08-isAnagram/index.js b/08-isAnagram/index.js index 918308a..8bec24f 100644 --- a/08-isAnagram/index.js +++ b/08-isAnagram/index.js @@ -1,4 +1,4 @@ export function isAnagram(word1, word2) { // implementar logica aqui - + return (word1.toLowerCase().split('').sort().join('')) === (word2.toLowerCase().split('').sort().join('')) } \ No newline at end of file -- 2.34.1 From 77abbade219c76e902917ab5638313bcb3560f31 Mon Sep 17 00:00:00 2001 From: danielmoliaribarbosa Date: Fri, 28 Oct 2022 15:15:21 -0300 Subject: [PATCH 09/10] =?UTF-8?q?feat(mostRepeatedChar):=20Implementa=20fu?= =?UTF-8?q?n=C3=A7=C3=A3o=20mostRepeatedChar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 09-mostRepeatedChar/index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/09-mostRepeatedChar/index.js b/09-mostRepeatedChar/index.js index b113ed8..bedc121 100644 --- a/09-mostRepeatedChar/index.js +++ b/09-mostRepeatedChar/index.js @@ -1,4 +1,16 @@ export function mostUsedChar(text) { // implementar logica aqui - return "" + const textObj = {} + let maxCount = 0 + let mostUsedChar = "" + for (let char of text) { + textObj[char] = textObj[char] + 1 || 1 + } + for (let key in textObj) { + if (textObj[key] > maxCount) { + maxCount = textObj[key] + mostUsedChar = key + } + } + return mostUsedChar } \ No newline at end of file -- 2.34.1 From 37e6c7c42b676bc156e2c954c89b7642564b21dd Mon Sep 17 00:00:00 2001 From: danielmoliaribarbosa Date: Fri, 28 Oct 2022 16:26:10 -0300 Subject: [PATCH 10/10] =?UTF-8?q?feat(longestWords):=20Implementa=20fun?= =?UTF-8?q?=C3=A7=C3=A3o=20longestWords?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 10-longestWords/index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/10-longestWords/index.js b/10-longestWords/index.js index a98d2d8..b07a2f3 100644 --- a/10-longestWords/index.js +++ b/10-longestWords/index.js @@ -1,4 +1,16 @@ export function longestWords(words) { // implementar logica aqui - + let long = 0; + let longWords = []; + for(let i = 0;i < words.length;i++){ + if(words[i].length >= long){ + long = words[i].length; + } + } + for(let j = 0;j < words.length;j++){ + if(words[j].length == long){ + longWords.push(words[j]); + } + } + return longWords; } \ No newline at end of file -- 2.34.1