-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yankouskia
committed
Feb 19, 2018
1 parent
96a7f5c
commit 1c24a12
Showing
5 changed files
with
742 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,20 @@ | ||
# advanced-zeros | ||
Let's count zeros! | ||
|
||
## Task | ||
|
||
Your task is to implement `getZerosCount` function, which takes any integer number `number` (`1 <= number <= 10^7`) as first argument and any integer number `base` (`2 <= base <= 256`) as second argument. You should calculate *how many zeros in the end of number, which is factorial of `number` in `base` base system* | ||
|
||
For example: | ||
```js | ||
const zerosCount = getZerosCount(10, 10); // Factorial of 10 is 3628800 and the same in 10th base system | ||
console.log(zerosCount); // 2. Because there is 2 *tail* zeros in number 3628800 | ||
``` | ||
|
||
```js | ||
const zerosCount = getZerosCount(16, 16); // Factorial of 16 is 20922789888000 in 10th base system and *130777758000* in 16th base system | ||
console.log(zerosCount); // 3. Because there is 3 *tail* zeros in number *130777758000* | ||
``` | ||
|
||
### Important! | ||
Do not try to calculate factorial! First - you will not get exact answer on big numbers. Second - it could take several years to calculate factorial on big integers! Try to think up your awesome solution without such calculations. Good luck! |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "advanced-zeros", | ||
"version": "1.0.0", | ||
"description": "Let's count zeros!", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "mocha test.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/yankouskia/advanced-zeros.git" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/yankouskia/advanced-zeros/issues" | ||
}, | ||
"homepage": "https://github.com/yankouskia/advanced-zeros#readme", | ||
"devDependencies": { | ||
"mocha": "^5.0.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = function getZerosCount(number, base) { | ||
// your implementation | ||
} |
Oops, something went wrong.