feat: Adiciona 09-mostRepeatedChar

This commit is contained in:
Izabela Balizardo 2022-10-29 20:19:17 -03:00
parent e35b0ad71b
commit ec3a93f1ad
2 changed files with 39 additions and 16 deletions

View File

@ -1,4 +1,27 @@
export function mostUsedChar(text) { export function mostUsedChar(text) {
// implementar logica aqui // implementar logica aqui
return ""
var cont = 0,
maior = 0;
var resp = text.toLowerCase();
var i = 0,
j = 0;
for (i = 0; i < text.length; i++) {
cont = 0;
for (j = 0; j < text.length; j++) {
if (resp[i] == text[j]) {
cont++;
}
}
if (maior < cont) {
maior= cont;
var result= resp[i];
}
}
return result;
} }