mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-11-13 06:23:00 +08:00
Merge branch 'master' into luhn_algorithm
This commit is contained in:
commit
a9f92a26b4
4842
package-lock.json
generated
4842
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@ -33,17 +33,17 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/trekhleb/javascript-algorithms#readme",
|
"homepage": "https://github.com/trekhleb/javascript-algorithms#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/cli": "^7.2.3",
|
"@babel/cli": "^7.4.4",
|
||||||
"@babel/preset-env": "^7.3.4",
|
"@babel/preset-env": "^7.4.5",
|
||||||
"@types/jest": "^24.0.9",
|
"@types/jest": "^24.0.15",
|
||||||
"eslint": "^5.15.1",
|
"eslint": "^6.0.1",
|
||||||
"eslint-config-airbnb": "^17.1.0",
|
"eslint-config-airbnb": "^17.1.0",
|
||||||
"eslint-plugin-import": "^2.16.0",
|
"eslint-plugin-import": "^2.18.0",
|
||||||
"eslint-plugin-jest": "^22.3.0",
|
"eslint-plugin-jest": "^22.7.1",
|
||||||
"eslint-plugin-jsx-a11y": "^6.2.1",
|
"eslint-plugin-jsx-a11y": "^6.2.1",
|
||||||
"eslint-plugin-react": "^7.12.4",
|
"eslint-plugin-react": "^7.14.2",
|
||||||
"husky": "^1.3.1",
|
"husky": "^2.5.0",
|
||||||
"jest": "^24.3.1"
|
"jest": "^24.8.0"
|
||||||
},
|
},
|
||||||
"dependencies": {}
|
"dependencies": {}
|
||||||
}
|
}
|
||||||
|
@ -22,10 +22,5 @@ describe('fibonacciClosedForm', () => {
|
|||||||
expect(fibonacciNthClosedForm(30)).toBe(832040);
|
expect(fibonacciNthClosedForm(30)).toBe(832040);
|
||||||
expect(fibonacciNthClosedForm(50)).toBe(12586269025);
|
expect(fibonacciNthClosedForm(50)).toBe(12586269025);
|
||||||
expect(fibonacciNthClosedForm(70)).toBe(190392490709135);
|
expect(fibonacciNthClosedForm(70)).toBe(190392490709135);
|
||||||
expect(fibonacciNthClosedForm(71)).toBe(308061521170129);
|
|
||||||
expect(fibonacciNthClosedForm(72)).toBe(498454011879264);
|
|
||||||
expect(fibonacciNthClosedForm(73)).toBe(806515533049393);
|
|
||||||
expect(fibonacciNthClosedForm(74)).toBe(1304969544928657);
|
|
||||||
expect(fibonacciNthClosedForm(75)).toBe(2111485077978050);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @return {number}
|
* @return {number}
|
||||||
*/
|
*/
|
||||||
export default function fibonacciClosedForm(position) {
|
export default function fibonacciClosedForm(position) {
|
||||||
const topMaxValidPosition = 75;
|
const topMaxValidPosition = 70;
|
||||||
|
|
||||||
// Check that position is valid.
|
// Check that position is valid.
|
||||||
if (position < 1 || position > topMaxValidPosition) {
|
if (position < 1 || position > topMaxValidPosition) {
|
||||||
|
Loading…
Reference in New Issue
Block a user