Fixing the spaces identation

This commit is contained in:
edumoreira1506 2019-08-26 09:12:16 -03:00
parent 2d87b6f7b3
commit 8ee786a598
2 changed files with 17 additions and 17 deletions

View File

@ -5,18 +5,18 @@
* @return {number[]}
*/
export default function tribonacci(n) {
const tribSequence = [0];
let currentValue = 1;
const tribSequence = [0];
let currentValue = 1;
if(n >= 2) {
tribSequence.push(currentValue);
}
if(n >= 2) {
tribSequence.push(currentValue);
}
for (let i = 2; i < n; i++) {
tribSequence.push(currentValue);
currentValue += tribSequence[i - 1] + tribSequence[i - 2];
}
for (let i = 2; i < n; i++) {
tribSequence.push(currentValue);
currentValue += tribSequence[i - 1] + tribSequence[i - 2];
}
return tribSequence;
return tribSequence;
}

View File

@ -5,14 +5,14 @@
* @return {number}
*/
export default function tribonacciNth(n) {
const tribSequence = [0, 0, 1];
let currentValue = 1;
const tribSequence = [0, 0, 1];
let currentValue = 1;
for (let i = 3; i <= n; i++) {
tribSequence.push(currentValue);
currentValue += tribSequence[i - 1] + tribSequence[i - 2];
}
for (let i = 3; i <= n; i++) {
tribSequence.push(currentValue);
currentValue += tribSequence[i - 1] + tribSequence[i - 2];
}
return tribSequence[n];
return tribSequence[n];
}