function repeated_yes_0_no_1(n) {
let st = new Set();
while (n != 0) {
let digit = n % 10;
if (st.has(digit)) { // repeated = yes
return 0;
}
st.add(digit);
n = Math.floor(n / 10);
}
return 1;
}
function GetTotalNumbersWithNoRepeatedDigits(start, end) {
let total = 0;
for (let i = start; i <= end; i++) {
total += repeated_yes_0_no_1(i);
}
return total;
}
const start = 1;
const end = 110;
console.log(GetTotalNumbersWithNoRepeatedDigits(start, end));
/*
run:
98
*/