Integer depth
This commit is contained in:
10
integer-depth/index.js
Normal file
10
integer-depth/index.js
Normal file
@@ -0,0 +1,10 @@
|
||||
// https://www.codewars.com/kata/integer-depth/javascript
|
||||
|
||||
function computeDepth(x) {
|
||||
const d = new Set();
|
||||
for (let i = 1;; ++i) {
|
||||
[...(x*i + '')].map(n => d.add(n));
|
||||
if (d.size === 10) return i;
|
||||
}
|
||||
return 10;
|
||||
}
|
||||
Reference in New Issue
Block a user