Merge pull request 'feature' (#1) from feature into master

Reviewed-on: #1
This commit is contained in:
Emilly Schuenck de Lima 2022-11-02 21:34:20 +00:00
commit 4720564104
10 changed files with 75 additions and 11 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 < 1) {
return 0;
}
return Math.max ( ...values)
}

View File

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

View File

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

View File

@ -1,4 +1,9 @@
export function sum(values) {
// implementar logica aqui
var sum = 0;
for (var i = 0; i < values.length; i++){
sum+= values [i]
}
return sum
}

View File

@ -1,4 +1,17 @@
import { sum } from "../06-sum";
export function sumEven(value) {
// implementar logica aqui
let par = []
for (let i = 0; i < value.length; i++) {
if (value[i] % 2 == 0) {
par.push(value[i])
}
}
let total = 0
for (let i = 0; i < par.length; i++) {
total += par[i];
}
value = [];
return total;
}

View File

@ -1,4 +1,12 @@
export function isAnagram(word1, word2) {
// implementar logica aqui
if (word1.length != word2.length){
return false;
}
let str1 = word1.toUpperCase().split("").sort().join("");
let str2 = word2.toUpperCase().split("").sort().join("");
let resultado = str1 === str2
return resultado;
}

View File

@ -1,4 +1,12 @@
export function mostUsedChar(text) {
// implementar logica aqui
return ""
}
// implementar logica aqui
let max = 0;
let mostRep = "";
text.split("").forEach(function (index) {
if (text.split(index).length > max) {
max = text.split(index).length;
mostRep = index;
}
});
return mostRep;
}

View File

@ -1,4 +1,13 @@
export function longestWords(words) {
// implementar logica aqui
let maior = "";
for (const string of words) {
if (string.length > maior.length) {
maior = string;
}
}
const maiores = words.filter((string) => string.length == maior.length);
return maiores;
}