const fs = require('fs');
const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt';
let input = fs.readFileSync(filePath).toString().trim().split('\n');
let N = Number(input[0]); //110
let count = 0;
function Fn(num) {
for(let i=1; i <= num; i++) {
let number = String(i);
let numArr = number.split('');
if (numArr.length > 0 && numArr.length < 3) {
count++;
} else if(numArr.length === 3) {
let gap1 = Number(numArr[1]) - Number(numArr[0]);
let gap2 = Number(numArr[2]) - Number(numArr[1]);
if(gap1 === gap2) {
count++;
}
}
}
return count;
}
const result = Fn(N);
console.log(result);
Math.abs(숫자) -> 절대값 반환
물론 이게 필요없는 문제였는데 헤매다보니까 이런거 알게됨
독해력을 기르자.......