mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-11-10 11:09:43 +08:00
Fixing the spaces identation
This commit is contained in:
parent
2d87b6f7b3
commit
8ee786a598
@ -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;
|
||||
}
|
||||
|
@ -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];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user