From 0748773ce8bfae39a51c78132074045089a8a92b Mon Sep 17 00:00:00 2001 From: Patrick Date: Fri, 28 Oct 2022 17:40:11 -0300 Subject: [PATCH 1/2] criando o codigo da area do triangulo --- 01-greeting/index.js | 2 +- 02-triangleArea/index.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/01-greeting/index.js b/01-greeting/index.js index 5c0279c..8f551af 100644 --- a/01-greeting/index.js +++ b/01-greeting/index.js @@ -1,4 +1,4 @@ export function greet(name) { // implementar logica aqui - return `Hello ${name}`; + return ""; } diff --git a/02-triangleArea/index.js b/02-triangleArea/index.js index 7628fcd..c4d5aa1 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 From 5b864a141734f85fd41baf44d077237f69cd113a Mon Sep 17 00:00:00 2001 From: Patrick Date: Wed, 2 Nov 2022 13:41:20 -0300 Subject: [PATCH 2/2] feat: criando o algoritmo para a lista com as palavras longas --- 10-longestWords/index.js | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/10-longestWords/index.js b/10-longestWords/index.js index a98d2d8..deef95f 100644 --- a/10-longestWords/index.js +++ b/10-longestWords/index.js @@ -1,4 +1,27 @@ export function longestWords(words) { - // implementar logica aqui - + // implementar logica aqui + const lengthArray = [] + + words.forEach(element => { + lengthArray.push([element, element.length ]) + }) + + + let res = ['', 0] + + lengthArray.forEach(array => { + if (res[1] < array[1]) { + res = array + } + }) + + const AllLongestWords = [] + + lengthArray.forEach(array => { + if (res[1] == array[1]) { + AllLongestWords.push(array[0]) + } + }) + + return AllLongestWords } \ No newline at end of file