You are viewing a single comment's thread. Return to all comments →
Javascript:
function reverse(n) { return Number(('' + n).split('').reverse().join('')); } function getBeautifulDayCount(i,j,k) { var count = 0; for (var num=i; num <= j; num++) { var diff = Math.abs(reverse(num) - num); if (diff % k === 0) { count++; } } return count; } function processData(input) { var arr = input.split(' ').map(Number); var i = arr[0]; var j = arr[1]; var k = arr[2]; console.log(getBeautifulDayCount(i,j,k)); }
Seems like cookies are disabled on this browser, please enable them to open this website
Beautiful Days at the Movies
You are viewing a single comment's thread. Return to all comments →
Javascript: