Integer depth

This commit is contained in:
2019-12-07 23:14:46 +01:00
parent f04abe7aa8
commit 012d22a6d7

10
integer-depth/index.js Normal file
View 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;
}