From 0adbe1909eeec798182901890813f1f74545481b Mon Sep 17 00:00:00 2001 From: Humberto Ferro Date: Fri, 28 Oct 2022 20:52:32 -0300 Subject: [PATCH 1/9] criar algoritmo aparecer hello --- 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 1b9c0dbafe26e5f7d3cef63e067c84b42bb086a5 Mon Sep 17 00:00:00 2001 From: Humberto Ferro Date: Sat, 29 Oct 2022 07:20:27 -0300 Subject: [PATCH 2/9] =?UTF-8?q?feat:=20criar=20algoritmo=20que=20realize?= =?UTF-8?q?=20o=20c=C3=A1lculo=20da=20=C3=A1rea=20do=20triangulo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 02-triangleArea/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/02-triangleArea/index.js b/02-triangleArea/index.js index 7628fcd..475c5ab 100644 --- a/02-triangleArea/index.js +++ b/02-triangleArea/index.js @@ -1,3 +1,4 @@ export function triangleArea(base, height) { - // your code here + var area = (base*height) / 2 + return area } \ No newline at end of file -- 2.34.1 From 31c440491fd39345229b954b160ce713fdebbcf6 Mon Sep 17 00:00:00 2001 From: Humberto Ferro Date: Sat, 29 Oct 2022 07:37:20 -0300 Subject: [PATCH 3/9] feat: criar algoritmo que realize a sequencia de fibonacci --- 04-fibonacci/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 37c64cc..4f10945 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,14 @@ export function fibonacci(value) { // implementar logica aqui - + if (value < 1) return 0 + if (value <= 2) return 1 + let fib1 = 0 + let fib2 = 1 + let fibN = value + for (let i = 2; i <=value; i++){ + fibN = fib2 + fib1 + fib1 = fib2 + fib2 = fibN + } + return fibN } \ No newline at end of file -- 2.34.1 From 53eee529521cce15c1346ca8aaecd48b4c9eeb88 Mon Sep 17 00:00:00 2001 From: Humberto Ferro Date: Sat, 29 Oct 2022 08:48:20 -0300 Subject: [PATCH 4/9] feat: criar algoritmo que realize a soma dos valores contidos na array --- 06-sum/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/06-sum/index.js b/06-sum/index.js index ebc2ee1..c6526a4 100644 --- a/06-sum/index.js +++ b/06-sum/index.js @@ -1,4 +1,9 @@ export function sum(values) { // implementar logica aqui + var soma = 0; + for (var i = 0; i < values.length; i++) { + soma += values[i]; + } + return soma; } \ No newline at end of file -- 2.34.1 From 88441d9bf3cb114c5c857975814c2f0e5c013645 Mon Sep 17 00:00:00 2001 From: Humberto Ferro Date: Sat, 29 Oct 2022 19:26:27 -0300 Subject: [PATCH 5/9] feat: criar algoritmo que realize a soma dos numeros pares --- 07-sumEven/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/07-sumEven/index.js b/07-sumEven/index.js index bb1e095..8dba971 100644 --- a/07-sumEven/index.js +++ b/07-sumEven/index.js @@ -1,4 +1,12 @@ export function sumEven(value) { // implementar logica aqui - + const pares = value; + var i; + let soma = 0; + for (i = 0; i <= pares.length; i++) { + if (pares[i] % 2 === 0) { + soma = soma + pares[i]; + } + } + return soma; } \ No newline at end of file -- 2.34.1 From 752b0d75a3bb214fd055d9397c33a44b83b5410e Mon Sep 17 00:00:00 2001 From: Humberto Ferro Date: Sat, 29 Oct 2022 19:31:39 -0300 Subject: [PATCH 6/9] feat: criar algoritmo que retome se uma palavra e anagrama de outra --- 08-isAnagram/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/08-isAnagram/index.js b/08-isAnagram/index.js index 918308a..dc5da45 100644 --- a/08-isAnagram/index.js +++ b/08-isAnagram/index.js @@ -1,4 +1,6 @@ export function isAnagram(word1, word2) { // implementar logica aqui - + word1 = word1.toUpperCase().split('').sort().join(''); + word2 = word2.toUpperCase().split('').sort().join(''); + return word1 === word2 } \ No newline at end of file -- 2.34.1 From 8198e91d6907bd176b581aea32814330adb85a1c Mon Sep 17 00:00:00 2001 From: Humberto Ferro Date: Sat, 29 Oct 2022 20:03:50 -0300 Subject: [PATCH 7/9] feat: criar algoritmo que encontre os maiores valores do arrays --- 03-maxValue/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/03-maxValue/index.js b/03-maxValue/index.js index e433b31..7ad07d1 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,4 +1,7 @@ export function maxValue(values) { // implementar logica aqui - + if (values.length === 0) { + return 0; + } + return Math.max.apply(null, values); } \ No newline at end of file -- 2.34.1 From 68ff6206f759b4e70f795f83ecdb8b31af0eb235 Mon Sep 17 00:00:00 2001 From: Humberto Ferro Date: Mon, 31 Oct 2022 09:55:11 -0300 Subject: [PATCH 8/9] feat: criar algoritmo que retorne a letra mais repetida --- 09-mostRepeatedChar/index.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/09-mostRepeatedChar/index.js b/09-mostRepeatedChar/index.js index b113ed8..756bb7e 100644 --- a/09-mostRepeatedChar/index.js +++ b/09-mostRepeatedChar/index.js @@ -1,4 +1,18 @@ export function mostUsedChar(text) { // implementar logica aqui - return "" + let result = ''; + let mostUsedCount = 0; + for (const letter of text) { + let countLetter = 0; + for (const letterToCount of text) { + if (letterToCount === letter) { + countLetter++; + } + } + if (countLetter > mostUsedCount) { + mostUsedCount = countLetter; + result = letter; + } + } + return result; } \ No newline at end of file -- 2.34.1 From cfdec8e85dd9c226156adcccd3c236b1d5d46516 Mon Sep 17 00:00:00 2001 From: Humberto Ferro Date: Mon, 31 Oct 2022 10:11:20 -0300 Subject: [PATCH 9/9] feat: criar algoritmo que retorne as palavras longas de uma lista de palavras --- 10-longestWords/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/10-longestWords/index.js b/10-longestWords/index.js index a98d2d8..d17f723 100644 --- a/10-longestWords/index.js +++ b/10-longestWords/index.js @@ -1,4 +1,14 @@ export function longestWords(words) { // implementar logica aqui - + let newArr = []; + let long = 0; + words.forEach(function(element){ + if(element.length > long){ + long = element.length + } + }); + newArr = words.filter(element => + element.length == long + ); + return newArr; } \ No newline at end of file -- 2.34.1