Merge branch 'master' of ssh://gitea.ecommercetools.com.br:22022/PatrickSouzaSilva/challenge-algorithms-v2.0 into develop

This commit is contained in:
PATRICK DE SOUZA SILVA 2022-11-02 17:30:31 -03:00
commit 1ceefbae00
3 changed files with 29 additions and 5 deletions

View File

@ -1,4 +1,4 @@
export function greet(name) {
// implementar logica aqui
return `Hello ${name}`;
return "";
}

View File

@ -1,4 +1,5 @@
export function triangleArea(base, height) {
// your code here
return ""
return base * height /2;
}

View File

@ -1,4 +1,27 @@
export function longestWords(words) {
// implementar logica aqui
return ""
}
// 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
}