Merge branch 'master' of ssh://gitea.ecommercetools.com.br:22022/PatrickSouzaSilva/challenge-algorithms-v2.0 into develop
This commit is contained in:
commit
1ceefbae00
@ -1,4 +1,4 @@
|
||||
export function greet(name) {
|
||||
// implementar logica aqui
|
||||
return `Hello ${name}`;
|
||||
return "";
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
export function triangleArea(base, height) {
|
||||
// your code here
|
||||
return ""
|
||||
|
||||
return base * height /2;
|
||||
}
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user