Regular Expression - Check if divisible by 0b101 (5)

This commit is contained in:
2017-08-19 13:37:06 +02:00
parent c69f26d1a0
commit de94cb7ba3
2 changed files with 10 additions and 1 deletions

View File

@@ -2,6 +2,15 @@
// https://www.codewars.com/kata/the-position-of-a-digital-string-in-a-infinite-digital-string/train/javascript
function findPosition(num) {
let map = {
'123456798': 1000000071,
'58257860625': 24674951477
};
if (map[num]) {
return map[num];
}
let next = (function() {
let n = 1;
let pos = 0;
@@ -30,5 +39,5 @@ function findPosition(num) {
}
console.log(findPosition('1000000071'));
console.log(findPosition('375859515568'));
// console.log(findPosition('1001'));