development #11

Merged
NicollyVieira merged 20 commits from development into master 2022-10-28 18:16:57 +00:00
10 changed files with 53 additions and 10 deletions

View File

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

View File

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

View File

@ -1,4 +1,7 @@
export function maxValue(values) {
// implementar logica aqui
if(values.length === 0) {
return 0;
}
return Math.max(...values);
}

View File

@ -1,4 +1,4 @@
export function fibonacci(value) {
// implementar logica aqui
return value <= 1 ? value : fibonacci(value - 1) + fibonacci(value - 2);
}

View File

@ -1,4 +1,11 @@
export function isPrime(value) {
// implementar logica aqui
let quantidadeDeDivisores = 0
for (let i = 1; i <= value; i++) {
if (value % i == 0) {
quantidadeDeDivisores++
}
}
return quantidadeDeDivisores == 2 ? true : false;
}

View File

@ -1,4 +1,6 @@
export function sum(values) {
// implementar logica aqui
return values.reduce((somatorio, valor) => {
return somatorio + valor
}, 0)
}

View File

@ -1,4 +1,8 @@
export function sumEven(value) {
// implementar logica aqui
const numerosPares = value.filter(valor => (valor % 2) == 0)
return numerosPares.reduce((somatorio, par) => {
return somatorio + par
}, 0)
}

View File

@ -1,4 +1,7 @@
export function isAnagram(word1, word2) {
// implementar logica aqui
let primeiraString = word1.toLowerCase().split('').sort().join('');
let segundaString = word2.toLowerCase().split('').sort().join('');
return primeiraString === segundaString ? true : false;
}

View File

@ -1,4 +1,19 @@
export function mostUsedChar(text) {
// implementar logica aqui
return ""
let textLower = text.toLowerCase().split('');
let caractereMaisRepetido;
let numeroDeCaractereRepetido = 0;
textLower.forEach(element => {
let caracteresRepetidos = textLower.filter((x) => x === element);
if (caracteresRepetidos.length > numeroDeCaractereRepetido) {
caractereMaisRepetido = caracteresRepetidos.filter((caractere, indice) => {
return caracteresRepetidos.indexOf(caractere) === indice
})
numeroDeCaractereRepetido = caracteresRepetidos.length
}
});
return caractereMaisRepetido.toString()
}

View File

@ -1,4 +1,12 @@
export function longestWords(words) {
// implementar logica aqui
let numeroDeCaractere = 0
words.forEach((word) => {
if (word.length >= numeroDeCaractere) {
numeroDeCaractere = word.length
}
})
return words.filter((palavra) => (palavra.length == numeroDeCaractere))
}