You are viewing a single comment's thread. Return to all comments →
C++
int beautifulDays(int i, int j, int k) { int count = 0; while(i <= j){ int reversed = reverseNumber(i); int number = i; int day = abs(number - reversed); if(day % k == 0) ++count; ++i; } return count; } int reverseNumber(int val){ int result = 0; while(val > 0){ result = result*10 + val%10; val /= 10; } return result; }
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 →
C++