Merge branch 'master' into fibonacci

This commit is contained in:
JenilChristo 2019-08-06 11:59:18 +05:30 committed by GitHub
commit 0c8060e92f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1191 additions and 3684 deletions

4850
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -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": {}
} }

View File

@ -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);
}); });
}); });

View File

@ -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) {