You are viewing a single comment's thread. Return to all comments →
Here is my c# solution, i didnt use array to reverse
public static int beautifulDays(int i, int j, int k) { int reverse = 0,day = 0; for(int num=i ; num <= j ; num++){ int temp = num; while(temp > 0){ reverse = reverse * 10 + temp % 10; temp /= 10; } int diff = Math.Abs(num - reverse); if(diff%k == 0){ day++; } reverse = 0; } return day; }
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 →
Here is my c# solution, i didnt use array to reverse