forked from M3-Academy/challenge-algorithms-v2.0
Merge branch 'fibonacci'
This commit is contained in:
commit
60e0bc9b84
@ -1,4 +1,6 @@
|
||||
export function fibonacci(value) {
|
||||
// implementar logica aqui
|
||||
|
||||
if(value < 2) {
|
||||
return value
|
||||
}
|
||||
return fibonacci(value - 1) + fibonacci(value - 2)
|
||||
}
|
@ -1,4 +1,8 @@
|
||||
export function isAnagram(word1, word2) {
|
||||
// implementar logica aqui
|
||||
|
||||
if (word1.length !== word2.length) {
|
||||
return false;
|
||||
}
|
||||
if (word1.length === word2.length) {
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,4 +1,15 @@
|
||||
export function mostUsedChar(text) {
|
||||
// implementar logica aqui
|
||||
return ""
|
||||
let h = new Set();
|
||||
|
||||
for(let i = 1; i <= text.length - 1; i++)
|
||||
{
|
||||
let c = text[i];
|
||||
|
||||
if (h.has(c))
|
||||
return c;
|
||||
|
||||
else
|
||||
h.add(c);
|
||||
}
|
||||
return '\0';
|
||||
}
|
@ -1,4 +1,7 @@
|
||||
export function longestWords(words) {
|
||||
// implementar logica aqui
|
||||
|
||||
var longest = "";
|
||||
for (var word of words) {
|
||||
if (words.length > longest.length) longest = words;
|
||||
}
|
||||
return longest;
|
||||
}
|
Loading…
Reference in New Issue
Block a user