From 7b01f4ee19a3346ddffe8cea9287acb22c089b41 Mon Sep 17 00:00:00 2001 From: Eleonora Otz Date: Fri, 28 Oct 2022 11:31:10 -0300 Subject: [PATCH 01/11] =?UTF-8?q?feat:=20Soluciona=20o=20exerc=C3=ADcio=20?= =?UTF-8?q?01=20-=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 ca578df017b2b80fe6b8f857fcaab54294e333dd Mon Sep 17 00:00:00 2001 From: Eleonora Otz Date: Fri, 28 Oct 2022 11:35:45 -0300 Subject: [PATCH 02/11] =?UTF-8?q?feat:=20Soluciona=20o=20exerc=C3=ADcio=20?= =?UTF-8?q?02=20-=20=C3=81rea=20do=20tri=C3=A2ngulo?= 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..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 9ecafd27857de6f4ba26decd07aff8980569b4d4 Mon Sep 17 00:00:00 2001 From: Eleonora Otz Date: Fri, 28 Oct 2022 15:52:25 -0300 Subject: [PATCH 03/11] =?UTF-8?q?feat:=20Soluciona=20o=20exerc=C3=ADcio=20?= =?UTF-8?q?03=20-=20Max=20value?= 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..f7d48ca 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,4 +1,8 @@ export function maxValue(values) { // implementar logica aqui - + if (values.length > 0){ + return values = Math.max (...values) + } else { + return 0 + } } \ No newline at end of file -- 2.34.1 From 2fed2845e91a480dd79f85a492bf5c52f394646a Mon Sep 17 00:00:00 2001 From: Eleonora Otz Date: Fri, 28 Oct 2022 16:02:42 -0300 Subject: [PATCH 04/11] =?UTF-8?q?feat:=20Soluciona=20o=20exerc=C3=ADcio=20?= =?UTF-8?q?04=20-=20Fibonacci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 04-fibonacci/index.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 37c64cc..cd85ba5 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,22 @@ export function fibonacci(value) { // implementar logica aqui + if(value < 1){ + return 0 + } + + if(value <= 2){ + return 1 + } + + let prev = 0 + let next = 1 + let result = 0 -} \ No newline at end of file + for (let i = 2; i <= value; i++){ + result = next + prev + prev = next + next = result + } + + return result + } \ No newline at end of file -- 2.34.1 From 1176d331b22718921985bf6ae41012b68fb79a7f Mon Sep 17 00:00:00 2001 From: Eleonora Otz Date: Fri, 28 Oct 2022 16:16:49 -0300 Subject: [PATCH 05/11] =?UTF-8?q?feat:=20Soluciona=20o=20exerc=C3=ADcio=20?= =?UTF-8?q?05=20-=20Is=20prime?= 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..17a08cf 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 104b003d48699de9fd0934725401b8ed7833aa79 Mon Sep 17 00:00:00 2001 From: Eleonora Otz Date: Fri, 28 Oct 2022 16:27:13 -0300 Subject: [PATCH 06/11] =?UTF-8?q?feat:=20Soluciona=20o=20exerc=C3=ADcio=20?= =?UTF-8?q?06=20-=20Sum?= 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..d71f726 100644 --- a/06-sum/index.js +++ b/06-sum/index.js @@ -1,4 +1,9 @@ export function sum(values) { // implementar logica aqui - + var sum = 0; + for(var i = 0; i < values.length; i++) { + sum += values[i]; + } + + return sum } \ No newline at end of file -- 2.34.1 From 3cdeba11dd1a81d36f0f9a2cd70b87256fcbf843 Mon Sep 17 00:00:00 2001 From: Eleonora Otz Date: Fri, 28 Oct 2022 16:33:50 -0300 Subject: [PATCH 07/11] =?UTF-8?q?feat:=20Soluciona=20o=20exerc=C3=ADcio=20?= =?UTF-8?q?07=20-=20Sum=20even?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 07-sumEven/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/07-sumEven/index.js b/07-sumEven/index.js index bb1e095..8267233 100644 --- a/07-sumEven/index.js +++ b/07-sumEven/index.js @@ -1,4 +1,11 @@ export function sumEven(value) { // implementar logica aqui - + let sum = 0 + + for(let i = 0; i < value.length; i++) { + if(value[i] % 2 === 0){ + sum += value[i] + } + } + return sum } \ No newline at end of file -- 2.34.1 From 2d18f109e10b257b14b3319cb8ba1ef262bae9b3 Mon Sep 17 00:00:00 2001 From: Eleonora Otz Date: Fri, 28 Oct 2022 16:41:45 -0300 Subject: [PATCH 08/11] =?UTF-8?q?feat:=20Soluciona=20o=20exerc=C3=ADcio=20?= =?UTF-8?q?08=20-=20Is=20anagram?= 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..160191a 100644 --- a/08-isAnagram/index.js +++ b/08-isAnagram/index.js @@ -1,4 +1,11 @@ export function isAnagram(word1, word2) { // implementar logica aqui - + word1 = word1.toUpperCase().split('').sort().join('') + word2 = word2.toUpperCase().split('').sort().join('') + + if(word1 === word2){ + return true; + } else { + return false; + } } \ No newline at end of file -- 2.34.1 From 32e2c086e3074acd88e38043a0199bb28f5e06f5 Mon Sep 17 00:00:00 2001 From: Eleonora Otz Date: Fri, 28 Oct 2022 16:49:33 -0300 Subject: [PATCH 09/11] =?UTF-8?q?feat:=20Soluciona=20o=20exerc=C3=ADcio=20?= =?UTF-8?q?09=20-=20Most=20repeated=20char?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 09-mostRepeatedChar/index.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/09-mostRepeatedChar/index.js b/09-mostRepeatedChar/index.js index b113ed8..be8b6b2 100644 --- a/09-mostRepeatedChar/index.js +++ b/09-mostRepeatedChar/index.js @@ -1,4 +1,19 @@ export function mostUsedChar(text) { // implementar logica aqui - return "" + let freqCounter = {} + let lcText = text.toLowerCase() + + for (let char of lcText) { + freqCounter[char] = freqCounter[char] + 1 || 1; + } + + let maxCount = 0; + let mostUsedChar = null; + for(let key in freqCounter) { + if(freqCounter[key] > maxCount) { + maxCount = freqCounter[key] + mostUsedChar = key + } + } + return mostUsedChar } \ No newline at end of file -- 2.34.1 From 9b3ac56a7c7358b738805daaaefd1480bcdce5ff Mon Sep 17 00:00:00 2001 From: Eleonora Otz Date: Tue, 1 Nov 2022 11:55:33 -0300 Subject: [PATCH 10/11] =?UTF-8?q?feat:=20Soluciona=20o=20exerc=C3=ADcio=20?= =?UTF-8?q?10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 10-longestWords/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/10-longestWords/index.js b/10-longestWords/index.js index a98d2d8..e9c2f7e 100644 --- a/10-longestWords/index.js +++ b/10-longestWords/index.js @@ -1,4 +1,19 @@ export function longestWords(words) { // implementar logica aqui + + let longestWord = '' + words.forEach((word) => { + if(word.length > longestWord.length){ + longestWord = word + } + }); + + const longestWords = words.filter((word) => { + if(word.length === longestWord.length){ + return word + } + }); + + return longestWords } \ No newline at end of file -- 2.34.1 From 1f5ef4cd49d9214b799778cd97efd62a88bf5192 Mon Sep 17 00:00:00 2001 From: Eleonora Otz Date: Tue, 1 Nov 2022 17:35:01 -0300 Subject: [PATCH 11/11] =?UTF-8?q?style:=20Troca=20var=20por=20let=20no=20e?= =?UTF-8?q?xerc=C3=ADcio=2006=20-=20Sum?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 06-sum/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/06-sum/index.js b/06-sum/index.js index d71f726..971a2ea 100644 --- a/06-sum/index.js +++ b/06-sum/index.js @@ -1,7 +1,7 @@ export function sum(values) { // implementar logica aqui - var sum = 0; - for(var i = 0; i < values.length; i++) { + let sum = 0; + for(let i = 0; i < values.length; i++) { sum += values[i]; } -- 2.34.1