From 02fe50448cd3e5300f127306a57b4c8e4f908890 Mon Sep 17 00:00:00 2001 From: LeonardoPereiraRocha Date: Fri, 28 Oct 2022 17:45:10 -0300 Subject: [PATCH 01/10] =?UTF-8?q?feat(01-greeting):=20Cria=20a=20fun=C3=A7?= =?UTF-8?q?=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 01-greeting/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/01-greeting/index.js b/01-greeting/index.js index 8f551af..021dae1 100644 --- a/01-greeting/index.js +++ b/01-greeting/index.js @@ -1,4 +1,3 @@ export function greet(name) { - // implementar logica aqui - return ""; + return `Hello ${name}`; } From 2f5d5c9c03e0458964b271d05fc93b6e730c2eb1 Mon Sep 17 00:00:00 2001 From: LeonardoPereiraRocha Date: Fri, 28 Oct 2022 17:50:34 -0300 Subject: [PATCH 02/10] =?UTF-8?q?feat(02-triangleArea):=20Cria=20a=20fun?= =?UTF-8?q?=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 02-triangleArea/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/02-triangleArea/index.js b/02-triangleArea/index.js index 7628fcd..ee6dd83 100644 --- a/02-triangleArea/index.js +++ b/02-triangleArea/index.js @@ -1,3 +1,5 @@ export function triangleArea(base, height) { - // your code here + let result; + result = (base * height) / 2; + return result } \ No newline at end of file From 00dff8d1364393a933a393cdcff7cf82836c20ab Mon Sep 17 00:00:00 2001 From: LeonardoPereiraRocha Date: Fri, 28 Oct 2022 18:31:47 -0300 Subject: [PATCH 03/10] =?UTF-8?q?feat(03-maxValue):=20Cria=20a=20fun=C3=A7?= =?UTF-8?q?=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 02-triangleArea/index.js | 2 +- 03-maxValue/index.js | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/02-triangleArea/index.js b/02-triangleArea/index.js index ee6dd83..4cc7b32 100644 --- a/02-triangleArea/index.js +++ b/02-triangleArea/index.js @@ -1,5 +1,5 @@ export function triangleArea(base, height) { let result; result = (base * height) / 2; - return result + return result; } \ No newline at end of file diff --git a/03-maxValue/index.js b/03-maxValue/index.js index e433b31..c195ce1 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,4 +1,15 @@ export function maxValue(values) { - // implementar logica aqui + let max = 0; + max = values[0]; + if (values.length === 0){ + return 0; + } + + for(let i= 0; i < values.length; i++) { + if (values[i] > max) { + max = values[i]; + } +} + return max; } \ No newline at end of file From da3c5aab720cd0451147f8decf3b99875e6fe7a0 Mon Sep 17 00:00:00 2001 From: LeonardoPereiraRocha Date: Fri, 28 Oct 2022 19:21:13 -0300 Subject: [PATCH 04/10] =?UTF-8?q?feat(04-fibonacci):=20Cria=20a=20fun?= =?UTF-8?q?=C3=A7=C3=A3o?= 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..e7b1ce3 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,13 @@ export function fibonacci(value) { - // implementar logica aqui + let previous = 0; + let sum = 0; + let next = 1; + + for (let i = 0; i < value; i++) { + sum = previous + next; + previous = next; + next = sum; + } + return previous; } \ No newline at end of file From fbe17ccd0730a05c07d0b507a3b40ae17a3fccc2 Mon Sep 17 00:00:00 2001 From: LeonardoPereiraRocha Date: Fri, 28 Oct 2022 20:53:25 -0300 Subject: [PATCH 05/10] =?UTF-8?q?feat(05-isPrime):=20Cria=20a=20fun=C3=A7?= =?UTF-8?q?=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 05-isPrime/index.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/05-isPrime/index.js b/05-isPrime/index.js index ec9c4ac..09d6377 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,17 @@ export function isPrime(value) { - // implementar logica aqui + if(value <= 1){ + return false; + } -} \ No newline at end of file + for (let i = 2; i < value; i++ ){ + if (value % i === 0) { + return false; + } + } + + return true; +} + + + + \ No newline at end of file From d51aa1b44ba5ecc57b150b5fc237dcf1cc8fcf56 Mon Sep 17 00:00:00 2001 From: LeonardoPereiraRocha Date: Fri, 28 Oct 2022 21:19:21 -0300 Subject: [PATCH 06/10] =?UTF-8?q?feat(06-sum):=20Cria=20a=20fun=C3=A7?= =?UTF-8?q?=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 06-sum/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/06-sum/index.js b/06-sum/index.js index ebc2ee1..1c56f1b 100644 --- a/06-sum/index.js +++ b/06-sum/index.js @@ -1,4 +1,6 @@ export function sum(values) { - // implementar logica aqui - + let sumAll = 0; + for (let i = 0; i < values.length; i++) { + sumAll = sumAll + values[i]; + } return sumAll; } \ No newline at end of file From 25cbe458a0b7094ab1b4df9d9cea99558c2a1cb0 Mon Sep 17 00:00:00 2001 From: LeonardoPereiraRocha Date: Fri, 28 Oct 2022 21:37:59 -0300 Subject: [PATCH 07/10] =?UTF-8?q?feat(07-sumEven):=20Cria=20a=20fun=C3=A7?= =?UTF-8?q?=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 07-sumEven/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/07-sumEven/index.js b/07-sumEven/index.js index bb1e095..fc7e880 100644 --- a/07-sumEven/index.js +++ b/07-sumEven/index.js @@ -1,4 +1,8 @@ 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 From e3706d57712d3c4570d3ca366c112798f0399192 Mon Sep 17 00:00:00 2001 From: LeonardoPereiraRocha Date: Wed, 2 Nov 2022 14:23:55 -0300 Subject: [PATCH 08/10] =?UTF-8?q?feat(08-isAnagram):=20Cria=20a=20fun?= =?UTF-8?q?=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 04-fibonacci/index.js | 1 + 08-isAnagram/index.js | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index e7b1ce3..c0602cd 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,5 @@ export function fibonacci(value) { + // let previous = 0; let sum = 0; let next = 1; diff --git a/08-isAnagram/index.js b/08-isAnagram/index.js index 918308a..eb064c3 100644 --- a/08-isAnagram/index.js +++ b/08-isAnagram/index.js @@ -1,4 +1,19 @@ export function isAnagram(word1, word2) { - // implementar logica aqui - + let testWord1; + let testWord2; + + if (word1.length !== word2.length) { + return false; + } + + + testWord1 = word1.toLowerCase('').split('').sort().join(''); + testWord2 = word2.toLowerCase('').split('').sort().join(''); + + if (testWord1 === testWord2) { + return true; + } + + return false; + } \ No newline at end of file From d2ea761b4fbfaa0dc65dff8cd74a8d5d9f051775 Mon Sep 17 00:00:00 2001 From: LeonardoPereiraRocha Date: Wed, 2 Nov 2022 16:11:57 -0300 Subject: [PATCH 09/10] =?UTF-8?q?feat(09-mostRepeatedChar):=20Cria=20a=20f?= =?UTF-8?q?un=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 09-mostRepeatedChar/index.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/09-mostRepeatedChar/index.js b/09-mostRepeatedChar/index.js index b113ed8..326b356 100644 --- a/09-mostRepeatedChar/index.js +++ b/09-mostRepeatedChar/index.js @@ -1,4 +1,19 @@ export function mostUsedChar(text) { - // implementar logica aqui - return "" -} \ No newline at end of file + let arrChar; + arrChar = text.split(''); + let countCharMax = 1; + let countChar = 0; + let char; + for (let i=0; i Date: Wed, 2 Nov 2022 17:14:55 -0300 Subject: [PATCH 10/10] =?UTF-8?q?feat(10-longestWords):=20Cria=20a=20fun?= =?UTF-8?q?=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 10-longestWords/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/10-longestWords/index.js b/10-longestWords/index.js index a98d2d8..57943c3 100644 --- a/10-longestWords/index.js +++ b/10-longestWords/index.js @@ -1,4 +1,10 @@ export function longestWords(words) { - // implementar logica aqui - + let longWord = ""; + let word; + for(word of words) { + if (word.length > longWord.length){ + longWord = word; + } + } + return words.filter((word) => word.length === longWord.length); } \ No newline at end of file