forked from M3-Academy/challenge-algorithms-v2.0
Merge pull request 'feat(maxValue): Adicionando algoritmo que retorna o valor maximo de um vetor.' (#3) from feature/maxValue into development
Reviewed-on: #3
This commit is contained in:
commit
79fa78887a
@ -1,4 +1,13 @@
|
||||
export function maxValue(values) {
|
||||
// implementar logica aqui
|
||||
|
||||
let max = values[0];
|
||||
if (values.length === 0) {
|
||||
return 0;
|
||||
} else {
|
||||
for (let index = 0; index <= values.length; index++) {
|
||||
if (max < values[index]) {
|
||||
max = values[index];
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user